One basic way to affect the size of a cell is to make it span more than one row or column, analogous to the HTML rowspan and colspan attributes. To manage this in wxPython, use the method SetCellSize(row, col, num_rows, num_cols). This sets the cell at the coordinates row, col to flow over num_rows rows and num_col cols. Under normal circumstances, each cell takes up one row and one column, so to get the cell to overflow, you need to pass a value higher than one to those parameters. Passing a num_rows or num_cols value that is zero or less results in an error. If you set up a cell size that overlaps another cell's previously declared overflow size, the previously set cell has its size reset to one row and one column. You can also shut off overflow display on a cell by cell basis using the method Set-CellOverflow(row, col, allow). Passing this method prevents the cell from overflowing even if its size has been set with SetCellSize().
A more typical method of sizing a grid is by managing the pixel size on a row or column basis. You can set the size of a specific row or column by using the method SetColSize(col, width) to change the width of a column, and SetRow-Size(row, height) to change the width of a row. Naturally, you can determine the current size of a row or column using GetColSize(col) or GetRowSize(row).
Was this article helpful?