wxGrid将单个单元格绑定到事件

问题描述

| 我正在尝试执行以下操作:
cell = self.grid.SetCellValue(0,\"test\")  # Where grid is the instance of wx.grid
                                             # and self is a wx.panel instance
self.grid.Bind(EVT_GRID_CELL_LEFT_CLICK,self.on_left_click,cell)
这是我尝试将单击单元格(0,0)绑定到self.on_left_click()的尝试。 但是,如果单击鼠标左键,此方法会将所有单元格绑定到此事件。 有没有办法绑定仅单元格(0,0)而没有其他单元格?     

解决方法

        一个更简单的解决方案是检查事件处理程序中事件的行和列,并仅在事件来自单元格(0,0)时才执行操作:
def on_left_click(self,evt):
    if evt.GetRow() == 0 and evt.GetCol() == 0:
        #do stuff
    evt.Skip()