Event-Driven Woes: making wxPython and Twisted work together

matiu matthew.s at orcon.net.nz
Thu Dec 30 21:05:10 CET 2004


Hi Daniel,

I went down that road for a long time. I made a recipe to help people
out:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286201

Don't be intimidated by the size, that's a whole demo app complete with
gui. It works quite well. It uses two threads, wx runs in the main
thread and twisted runs in the second thread.

You'll probably just want to glean solutions from it and write your own
framework. It does still have some hicups!

I gave up trying to perfectionalise it and switched to pygtk, glade and
libglade.

pygtk runs fine on both linux and windows, and you get a gui designer.
The only downside is that it has less widgets. It has the advantage of
themes though, this means on windows you can make it look like windows,
linux, mac or whatever. Also your app will load faster than a wx app.
Unfortunately it does take up more disk space though.

Anyway to make wx and twisted work together, put twisted in a secondary
thread. I tried making them co-exist in a single thread as some other
recipes suggest, but basically modal dialogs don't seem to work
properly.

This recipe might be an easier solution for you. Haven't tried it
though:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/203471
God Bless




More information about the Python-list mailing list