I can't figure out how to pass a parameter with my
event binding. For example, suppose I want to pass the
name of the button that was just clicked. Normally I'd
do this:
self.button1 = wx.Button(panel, -1, label="Start")
self.Bind(wx.EVT_BUTTON, self.OnStart,
id=self.button1.GetId())
def OnStart(self, event):
....print "pressed!"
However, what if I wanted to pass a paramter to my
OnStart function. This is the gist of what I want to
do, but this doesn't work. Note the addition of the
"something" variable:
self.button1 = wx.Button(panel, -1, label="Start")
self.Bind(wx.EVT_BUTTON, self.OnStart("something"),
id=self.button1.GetId())
def OnStart(self, event, myvar):
....print myvar
TypeError: OnStart() takes exactly 3 arguments (2
given)
Any tips on this?
ยทยทยท
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping