[Twisted-Python] wxPython locking the event processing?

Patrik Blommaskog pb_twisted at olga.mine.nu
Sat Jul 5 12:48:59 MDT 2003


> -----Original Message-----
> From: twisted-python-admin at twistedmatrix.com
> [mailto:twisted-python-admin at twistedmatrix.com]On Behalf Of Uwe C.
> Schroeder
> Sent: den 5 juli 2003 19:57
> To: twisted-python at twistedmatrix.com
> Subject: Re: [Twisted-Python] wxPython locking the event processing?
>
>
> On Saturday 05 July 2003 10:14 am, Itamar Shtull-Trauring wrote:
> > On Sat, 5 Jul 2003 18:24:49 +0200
> >
> > "Patrik Blommaskog" <pb_twisted at olga.mine.nu> wrote:
> > > Meanwhile, is there anything that I should be aware of considering
> > > that we now have separate threads for wx and Twisted? Can I for
> > > example use reactor.callLater() to call methods on wx objects, or work
> > > with Perspectives, Cacheables, reactor etc from wx event handlers
> > > without any problems?
> >
> > They will break horribly. So, use reactor.callFromThread to call twisted
> > APIs from wx thread

Good, that's what I did already. :)

So if I understand it correctly, at least reactor.callFromThread (and
callLater?) are thread safe in this case?

> > and the wx equivalent to call wx APIs from the
> > twisted thread.
>
> The wx equivalent should be wx.CallAfter, which will schedule the given
> function in the (wx) mainthread.

Thanks!

> Even if you decide to use the unthreaded
> recipe I posted on activestate, you will still have to call wx
> functions from outside a twisted callback.

I'm not sure I understand. Do you mean that a reactor.callFromThread won't
do to, say, insert text into a text control, and I should use wx.CallAfter
instead, even in your unthreaded recipe?

- Patrik






More information about the Twisted-Python mailing list