首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

wxpython中怎么区分绑定同一个事件的多个button

2012-02-10 
wxpython中如何区分绑定同一个事件的多个button例如: self.Bind(wx.EVT_BUTTON, self.onButton, button1)s

wxpython中如何区分绑定同一个事件的多个button
例如: 
  self.Bind(wx.EVT_BUTTON, self.onButton, button1)
  self.Bind(wx.EVT_BUTTON, self.onButton, button2)
  self.Bind(wx.EVT_BUTTON, self.onButton, button3)

 def onButton(self, evt):
  ...

在如上代码中如何在onButton中获知是哪个button触发的事件?

谢谢!


[解决办法]
evt有个GetEventObject方法可以获取和事件相关的控件,按钮控件要用某种方式记录下来,后面好调用比对,譬如self.button1,self.button2 ...

热点排行