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) 而不结合其他细胞?
I am trying to do the following:
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)
this is my attempt at binding the event of clicking cell (0, 0) to self.on_left_click().
But this method binds all cells to this event in the event of a left click.
Is there a way to bind ONLY cell (0, 0) and no other cells?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个更简单的解决方案可能是在事件处理程序中检查事件的行和列,并仅当事件来自单元格 (0,0) 时才执行操作:
An easier solution might be to check the event's row and column in your event handler, and perform your actions only if the event came from cell (0,0):