How can I give a variable to a function when I bind something? As a simple example:
def test(self):
self.MyTextCtrl.Bind(wx.EVT_TEXT, self.something, AnyVariable)
def something(self, event, x)
# do something
print x
As you see, I want to give the value "AnyVariable" to the function "something" so that it will be used as the "x". How can I do this? This example doesn't work.
Edit: @ Paul McNett: Yeah, what I'm trying to do is more like:
def test(self):
self.MyTextCtrl1.Bind(wx.EVT_TEXT, self.something, Variable1)
self.MyTextCtrl2.Bind(wx.EVT_TEXT, self.something, Variable2)
self.MyTextCtrl3.Bind(wx.EVT_TEXT, self.something, Variable3)
def something(self, event, x)
# do something by including x
x=Variable1 when "MyTextCtrl1" is edited, x=Variable2 when "MyTextCtrl2" is edited and x=Variable3 when "MyTextCtrl3" is edited.
Of course I also could write 3 different functions ("def something1", "def something2", "def something3") and bind them to "MyTextCtrl1", "MyTextCtrl2" or "MyTextCtrl3". But I thought it could be much easier when I use this variable instead ;)