def printSelectedCells(self, top_left, bottom_right):
"""
Based on code from
http://ginstrom.com/scribbles/2008/09/07/getting-the-selected-cells-from-a-wxpython-grid/
"""
cells = []
rows_start = top_left[0]
rows_end = bottom_right[0]
cols_start = top_left[1]
cols_end = bottom_right[1]
rows = range(rows_start, rows_end+1)
cols = range(cols_start, cols_end+1)
cells.extend([(row, col)
for row in rows
for col in cols])
print("You selected the following cells: ", cells)
for cell in cells:
row, col = cell
print(self.myGrid.GetCellValue(row, col))
评论列表
文章目录