wx.CallLater issue

Hello guys,

I have installed wxPython 2.9.2.4 and have an issue with the
wx.CallLater class. It says that it takes at least 3 arguments and
that I only gave 2 of them. So here's the code...

    def OnButton(self, event):
        """Show a dialog window to display a question."""

        with wx.MessageDialog(self,
                                           caption='Question',
                                           message='You rang?',
                                           style=wx.YES_NO | wx.ICON_QUESTION) \
        as dialog:
            if dialog.ShowModal() == wx.ID_YES:
                self.statusBar.SetStatusText(text='Please stop ringing.',
                                                          number=0)
            wx.CallLater(callable=self.statusBar.SetStatusText,
                               text='',
                               number=0,
                               millis=3000)

And the exception I get is this...

Exception AttributeError: "CallLater instance has no attribute
'timer'" in <bound method CallLater.__del__ of <wx._core.CallLater
instance at 0x032DA120>> ignored
Traceback (most recent call last):
  File "C:\Users\Somebody\Desktop\My Projects\Sandbox\gui.py", line
144, in OnButton
    millis=3000)
TypeError: __init__() takes at least 3 arguments (2 given)

In what way was the wx.CallLater class changed in wxPython 2.9.2.4?

` CallLater
sig from doc of 2.8.9.2: init(self, millis, callable, *args, **kwargs)

    So, I think it should be this, but not sure as I don't use

CallLater.

  `
                               wx.CallLater(3000, self.statusBar.SetStatusText,
text='',
number=0)

Werner

···

On 10/09/2011 08:20 PM, Boštjan Mejak wrote:


Hello guys,
I have installed wxPython 2.9.2.4 and have an issue with the
wx.CallLater class. It says that it takes at least 3 arguments and
that I only gave 2 of them. So here's the code...
def OnButton(self, event):
"""Show a dialog window to display a question."""
with wx.MessageDialog(self,
caption='Question',
message='You rang?',
style=wx.YES_NO | wx.ICON_QUESTION) \
as dialog:
if dialog.ShowModal() == wx.ID_YES:
self.statusBar.SetStatusText(text='Please stop ringing.',
number=0)
wx.CallLater(callable=self.statusBar.SetStatusText,
text='',
number=0,
millis=3000)

Werner, I am aware of the signature from the old docs (which still
document the wxPython 2.8.9.2)... I, myself, am running this code on
wxPython 2.9.2.4... Can you tell me the new signature of wx.CallLater?

It appears the sig is the same in 2.9.2.4:

def __init__(self, millis, callableObj, *args, **kwargs):

Michael

···

On 10/9/2011 2:02 PM, Bo�tjan Mejak wrote:

Werner, I am aware of the signature from the old docs (which still
document the wxPython 2.8.9.2)... I, myself, am running this code on
wxPython 2.9.2.4... Can you tell me the new signature of wx.CallLater?

thanks! I've fixed my app... there is, however, a slight change after
all... before 2.9 the arg name is "callable", but now it is
"callableObj" :slight_smile:

Yes, callable is a built-in function so I changed the name of the parameter to not conflict with it (because I wanted to use callable() inside CallAfter and CallLater.)

···

On 10/9/11 2:01 PM, Bo�tjan Mejak wrote:

thanks! I've fixed my app... there is, however, a slight change after
all... before 2.9 the arg name is "callable", but now it is
"callableObj" :slight_smile:

--
Robin Dunn
Software Craftsman