2013-10-10 29 views
0

我已經在面板它們都具有相同的onclick事件在3個按鈕事件的ID,現在我得找哪個按鈕被稱爲onclick事件,它的IDwxPython中,如何找到按鈕,提出

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 

回答

1

對象本身如何?

button = event.GetEventObject() 

然後就可以調用GetId()GetName()GetLabel() ...