Quantcast

wx.CallLater issue

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wx.CallLater issue

Boštjan Mejak
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?

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.CallLater issue

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)

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

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.CallLater issue

Boštjan Mejak
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?

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.CallLater issue

Michael Hipp-3
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?
>
It appears the sig is the same in 2.9.2.4:

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

Michael

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.CallLater issue

Boštjan Mejak
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" :)

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.CallLater issue

Robin Dunn
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" :)
>

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.)

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Loading...