By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

a command I can't find.

P: 19
Hello I need a command to be able to do the following.

Expand|Select|Wrap|Line Numbers
  1.  
  2. button1 = wx.Button(ect, ect)
  3. button1.Bind(wx.EVT_BUTTON, self.button)
  4. button2 = wx.Button(ect, ect)
  5. Button2.Bind(wx.EVT_BUTTON, self.button)
  6.  
  7. def button(evt):
  8. evt.????????????
  9.  
????????? = I need a command to retrive the button label without knowing which button caused the evt_button event.
Jan 17 '09 #1
Share this Question
Share on Google+
2 Replies


kaarthikeyapreyan
100+
P: 107
The Event handler passes the necessary information to event
Expand|Select|Wrap|Line Numbers
  1. import wx
  2.  
  3. class baseframe(wx.Frame):
  4.     def __init__(self):
  5.         wx.Frame.__init__(self,None,-1,'Find Label',size=(200,250))
  6.         self.button1 = wx.Button(self, 1, 'Button 1', (50, 50))
  7.         wx.Button(self, 2, 'Button 2', (50, 150))
  8.         self.Bind(wx.EVT_BUTTON,self.getlabel)
  9.  
  10.     def getlabel(self,event):
  11.         print event.GetEventObject().GetLabel()
  12.  
  13. app = wx.App()
  14. obj=baseframe()
  15. obj.Show()
  16. app.MainLoop()
Jan 19 '09 #2

P: 19
Thanks,
That's just what I was looking for.

Josh
Jan 20 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.