[Twisted-Python] Twisted with wxPython in a thread

Gabriel Rossetti gabriel.rossetti at arimaz.com
Tue Aug 24 16:56:33 EDT 2010

On 08/24/2010 07:32 PM, Andrew Francis wrote:
> Hi
>> I can't find any examples of using Twisted with wxPython, were wx is in
>> a seperate thread. I used to have one somewhere but can' t find it
>> either. I'm looking because for some reason my code doesn't work (the
>> GUI freezes), even though I use reactor.callFromThread() for Twisted
>> calls from wx and wx.CallAfter() for wx calls from Twisted. Can anyone
>> point me to an example?
> This may be off topic but isn't there a wxReactor() so that you can
> avoid a separate thread?
> Cheers,
> Andrew

Yes, I know, but I'm using Twisted in a way that I allow blocking 
because it doesn't matter in my application, I receive a msg then access 
hardware and therefor I can only do one thing at a time (with this 
hardware anyways). If I use wxreactor with this model the GUI freezes up 
when I access the IO. I used to use wxreactor, put the IO calls in a 
queue and run one after another in a thread but this posed other 
problems when I needed to interact in between the GUI, the network 
(Twisted) and the IO threads, with my current code it has become much 
simpler and more reliable.


More information about the Twisted-Python mailing list