[Twisted-Python] wxPython locking the event processing?

Patrik Blommaskog pb_twisted at olga.mine.nu
Sat Jul 5 14:41:46 MDT 2003


> > > 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?
>
> Depends on what you call. You can set field values. Basically you
> can call
> anything from a callback that doesn't block. So don't open any
> modal dialogs
> from a callback. Otherwise setting/getting values etc. works.
> Whenever you experience a block, check the callbacks first to see
> if you're
> opening something that blocks.
> I.e. I use error callbacks that open an error message dialog.
> This will block
> the loop until you close the dialog. In this case the error
> message dialog is
> fine, since I don't care if it blocks - it's an error anyways, so
> the user
> has to click it away to continue. Not so with a - say "settings"
> dialog. The
> user would want to do input there and that won't work. Therefor
> whenever I
> have to open a modal dialog from a callback, I create a second method for
> that and use wx.CallAfter.

I see, this makes sense. Thanks a lot for the advice.

I´ve got my app working now with the threading method that Philippe
suggested. I think I'll implement your recipe as well, keep them in
parallell for a while, and see if I can learn anything from observing their
behaviors.


- Patrik






More information about the Twisted-Python mailing list