def grid_set_shape(self, new_rows, new_cols, default_col_size=None):
current_rows, current_cols = self.grid.GetNumberRows(), self.grid.GetNumberCols()
if new_rows < current_rows:
self.grid.DeleteRows(0, current_rows - new_rows, True)
if new_cols < current_cols:
self.grid.DeleteCols(0, current_cols - new_cols, True)
if new_rows > current_rows:
self.grid.AppendRows(new_rows - current_rows)
if new_cols > current_cols:
self.grid.AppendCols(new_cols - current_cols)
if default_col_size:
map(lambda col: self.grid.SetColSize(col, default_col_size), range(new_cols))
评论列表
文章目录