The GridView class is an abstract base class for widgets that display
information in a regular grid of rows and columns. Subclasses implement
methods that define the size of the grid, for drawing a cell of the
grid and for responding to mouse clicks in a cell.
- GridView(cell_size, nrows, ncols)
- Initializes the grid view with the specified cell_size, and a rect sized to show nrows rows and ncols columns of cells.
Note that nrows and ncols are used only for calculating the initial size of the widget, and are not stored.
- A tuple defining the size of one grid cell.
- cell_rect(row, col)
- Returns a rectangle covering the cell for row row and column col.
- Should return the current number of rows in the grid.
- Should return the current number of columns in the grid.
- draw_cell(surface, row, col, rect)
- Should draw the cell at row row and column col inside the specified rectangle.
- click_cell(row, col, event)
- Called when a mouse-down event occurs in the cell at row row and column col.