wx.CallAfter() not callable on Mac OSX

Hi,

I’m doing some stuff with threads, and was reading that I should use wx.CallAfter() to accomplish this smoothly

It works fine under linux, but on my mac I receive the following error:

File “/Users/james/projects/french75/french75.py”, line 313, in animate_cell

wx.CallAfter(self.draw_plot.vertical_line())

File “/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 16769, in CallAfter

assert callable(callableObj), “callableObj is not callable”

I tried googling this and couldn’t find anything.

Is CallAfter() not supported on the mac, or should I be using something else?

Thanks

James

Use
wx.CallAfter(self.draw_plot.vertical_line)

That is, you need to pass a function (a callable object), not the result of running a function (unless, of course, that function is returning a function that you want CallAfter to call).

···

On Sunday, October 20, 2013 11:48:44 AM UTC-5, James Hulme wrote:

Hi,

I’m doing some stuff with threads, and was reading that I should use wx.CallAfter() to accomplish this smoothly

It works fine under linux, but on my mac I receive the following error:

File “/Users/james/projects/french75/french75.py”, line 313, in animate_cell

wx.CallAfter(self.draw_plot.vertical_line())

File “/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 16769, in CallAfter

assert callable(callableObj), “callableObj is not callable”

I tried googling this and couldn’t find anything.

Is CallAfter() not supported on the mac, or should I be using something else?

Ah! Can’t believe I missed that.

Thanks!

···

On 21 October 2013 00:17, Matthew Newville matt.newville@gmail.com wrote:

On Sunday, October 20, 2013 11:48:44 AM UTC-5, James Hulme wrote:

Hi,

I’m doing some stuff with threads, and was reading that I should use wx.CallAfter() to accomplish this smoothly

It works fine under linux, but on my mac I receive the following error:

File “/Users/james/projects/french75/french75.py”, line 313, in animate_cell

wx.CallAfter(self.draw_plot.vertical_line())

File “/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py”, line 16769, in CallAfter

assert callable(callableObj), “callableObj is not callable”

I tried googling this and couldn’t find anything.

Is CallAfter() not supported on the mac, or should I be using something else?

Use

wx.CallAfter(self.draw_plot.vertical_line)

That is, you need to pass a function (a callable object), not the result of running a function (unless, of course, that function is returning a function that you want CallAfter to call).

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/KdnxFLh-alU/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.