2011-05-27 33 views
0

我努力做到以下几点:wxGrid单细胞结合事件

cell = self.grid.SetCellValue(0, 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)而没有其他单元格?

回答

1

更简单的解决办法可能是检查事件的行和列在你的事件处理程序,并执行你的行动只有当事件从小区出来(0,0):

def on_left_click(self, evt): 
    if evt.GetRow() == 0 and evt.GetCol() == 0: 
     #do stuff 
    evt.Skip()