[Twisted-Python] Welcome (and some questions)

Bob Ippolito bob at redivi.com
Sun Sep 11 12:17:41 MDT 2005


On Sep 11, 2005, at 10:28 AM, <Henning.Ramm at mediapro-gmbh.de>  
<Henning.Ramm at mediapro-gmbh.de> wrote:

>>> 5) Does there exist example of twisted application with wxpython  
>>> GUI?
>>>
>>
>> wxPython is a challenge to integrate with.  There have been
>> several strategies attempted and discarded over the years.
>> The current popular idea involves a new reactor which lets a
>> foreign event loop maintain more control over the program's
>> execution.  There has been no Twisted release since this was
>> added though, so if you want to try it out you'll need to get
>> an SVN checkout of Twisted.  If you do, you'll find some
>> examples in doc/core/examples/threadedselect/.  You can also
>> browse these online at
>> <http://cvs.twistedmatrix.com/cvs/trunk/doc/core/examples/threa
>>
> dedselect/>.
>
> threadedselectreactor works great, and you need only one file from  
> SVN.
>
> Here are the basics to use it:
>
> import wx
> from twisted.internet import threadedselectreactor
> threadedselectreactor.install()
> from twisted.internet import reactor
>
> # on startup (in my app's __init__):
> reactor.interleave(wx.CallAfter)
>
> # on end (in my app's __del__):
> reactor.stop()
>
> main = MyApp()
> main.MainLoop()

Note that this example is not correct in some cases (shutdown is  
wrong).  You should look at the threadedselectreactor examples before  
writing code, as they are correct.

-bob





More information about the Twisted-Python mailing list