[Twisted-Python] non blocking wxPython

Chris Liechti cliechti at gmx.net
Wed May 21 21:10:27 MDT 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.

chris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wxnoblock_thread.py
URL: </pipermail/twisted-python/attachments/20030522/f904450c/attachment.ksh>


More information about the Twisted-Python mailing list