Reputation: 289
We know that wxCallAfter works from function to function:
def onButton(self, event):
wx.CallAfter(self.functionOne)
def functionOne(self):
print "functionOne fired!"
How do you call an action using wx.CallAfter to the init using my objects? I have an button pressed that in turn, changes a list at that init class.
Here is what I have progressed to:
class LeftPanel(wx.Panel):
def __init__(self,parent, *args, **kwargs):
wx.Panel.__init__(self,parent)
self.radioLabel = self.myListener(self,parent,*args, **kwargs)
print 'Line 28 is %s' % self.radioLabel ## Line 28 is None, looking for a list!
Below on same panel:
def myListener(self, message, arg2=None):
print '378 left listener try is %s' % message
self.radioLabel = message
try:
wx.CallAfter(self.__init__)
except TypeError:
return
Traceback:
lambda event: event.callable(*event.args, **event.kw) )
TypeError: __init__() takes at least 2 arguments (1 given)
Upvotes: 0
Views: 792
Reputation: 33111
You don't call a class, you instantiate it. So if you need to instantiate a class, I would do that in a method:
def someMethod(self):
obj = SomeClass(*args, **kwargs)
Then you can call the method with wx.CallAfter:
wx.CallAfter(someMethod)
Upvotes: 1