[Twisted-Python] twisted robot ...

Antoine Pitrou solipsis at pitrou.net
Mon Apr 25 10:15:00 EDT 2005


Hi,

> At the moment we've got Twisted in the main thread, spawning
> a thread to run wx.  It works nicely except we can't figure
> out how to communicate with wx (ie., generate wxevents)
> from twisted.  (We don't need the converse - it's notification
> only.)

You just have to call wx.CallAfter, it will let you call any function
inside the wx thread. I've put an example of this use online:
http://solipsis.netofpeers.net/wiki/WxTwistedExample

It may be better, by the way, to run wx in the main thread and Twisted
in the secondary thread. Some toolkits supported by wx may not like the
fact that they aren't called from the main thread - I'm not sure such a
limitation exists but I'm not sure of the contrary either. Twisted,
OTOH, does not seem to care at all.

Regards

Antoine.






More information about the Twisted-Python mailing list