[Twisted-Python] non blocking wxPython

Chris Liechti cliechti at gmx.net
Wed May 21 23:10:27 EDT 2003

this is an example with wxPython + Twisted.
it does not suffer from the problem of blocked Twisted when wx menus or 
dialogs are open because Twisted is run in a separate thread.

on shutdown, twisted should be stopped first and then the GUI, in case
some twisted callbacks use GUI components (which is the purpose of most 
GUIs, isn't it ;-) thread.join() can be used in wx event handler as it 
produces a deadlock in case a callback is ran that accesses the GUI, 
thus a loop with wxYield() is used.

running Twisted in a separate thread may break some functions, altough i 
had no problems here. an other drawback is that it uses the (evil ;-) 
threads so you get all the problems of threads too, in some cases a 
callFromThread may be required (for wx->twisted calls).

i tested the example on win32, hope it runs as flawlessly on linux too.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wxnoblock_thread.py
Url: http://twistedmatrix.com/pipermail/twisted-python/attachments/20030522/f904450c/attachment.txt 

More information about the Twisted-Python mailing list