[Twisted-Python] Re: wxPython
Antoine Pitrou
solipsis at pitrou.net
Thu Feb 10 03:38:58 MST 2005
> There are different ways to couple the Twisted and wxPython event
> loops, with varying benefits and constraints. Generally speaking you
> need to decide which loop is the master and then handle updating the
> other loop from within the main loop. The wx reactor is an example of
> Twisted owning the main loop with periodic updates to the wxPython
> message loop.
In general I think trying to mix two event loops is a bad approach,
especially if you have timers, idle events and the like. You always end
up having one loop starving the other, unless you do some busy waiting
which eats up your CPU.
I'm using another approach which is two have two threads, one for the wx
event loop and one for the Twisted event loop. The two threads
communicate quite simply using some proxy objects which forward method
calls.
I've written a little example of this approach here:
http://solipsis.netofpeers.net/wiki/wikka.php?wakka=WxTwistedExample
Regards
Antoine.
More information about the Twisted-Python
mailing list