wxpython如何查找引发事件的按钮的id
我在一个面板中创建了3个按钮,它们都有相同的onclick事件,现在我必须找到哪个按钮调用了onclick事件及其IDwxpython如何查找引发事件的按钮的id,wxpython,Wxpython,我在一个面板中创建了3个按钮,它们都有相同的onclick事件,现在我必须找到哪个按钮调用了onclick事件及其ID k=5 j=400 for i in range(k): j=j+20 self.Bind(wx.EVT_BUTTON,self.OnButton2Button,id=j) def OnButton2Button(self,event): #what should i code here to get id or name of bu
k=5
j=400
for i in range(k):
j=j+20
self.Bind(wx.EVT_BUTTON,self.OnButton2Button,id=j)
def OnButton2Button(self,event):
#what should i code here to get id or name of button which raised click event
物体本身呢
button = event.GetEventObject()
然后可以调用GetId()
,GetName()
,GetLabel()