[Twisted-Python] Twistd .tac + wxpython

Gabriel Rossetti gabriel.rossetti at arimaz.com
Fri Aug 21 09:11:34 EDT 2009

Glyph Lefkowitz wrote:
> Hi Gabriel,
> On Thu, Aug 20, 2009 at 5:20 AM, Gabriel Rossetti 
> <gabriel.rossetti at arimaz.com <mailto:gabriel.rossetti at arimaz.com>> wrote:
>     I thought
>     of maybe putting the wx mainloop in a thread and using the standard
>     reactor but I don't know how well this works or even if it's possible.
> If you've already got all the appropriate code to separate out the GUI 
> into a separate thread and communicate with the networking components 
> via message queues, then this should work just fine.  Normally I'd 
> suspect wx (which I find to be a highly idiosyncratic, buggy, and 
> arbitrarily limited library: have you considered using something else 
> for your GUI?) might have some difficulties that I'm not aware of, but 
> I'm pretty sure several other Twisted users have already done this 
> exact type of integration.
> Personally, regardless of UI toolkit, in this situation I'd have the 
> server start up with a "normal" reactor (select, poll, epoll, kqueue: 
> take your pick) and have it spawn a separate GUI process with the GUI 
> reactor, and communicate via a socket.  That way the GUI can be shut 
> down and restarted without killing the back-end, and the back-end 
> could be moved to a different machine.  But I don't know a lot about 
> your application and there may be some requirements I'm not aware of :).
Hi Glyph,

I have 3 versions of my code, one using wxreactor, one where the 
mainloop is wx's and Twisted's reactor is in a thread, and one where 
it's Twisted's reactor as the mainloop and wx is in a thread.

To answer your question, originally I considered pyQT but when I saw 
that it wasn't free I changed my mind. pyGTK, the problem is the 
integration in different OSes, I need great integration in Linux, Mac OS 
X and Windows and  GTK apps don't do that as well.

Yes, that is what I ended up doing :-)


More information about the Twisted-Python mailing list