[wxPython-users] pubsub from threads
Jorgen Bodde
jorgen.maillist at gmail.com
Tue Jan 15 04:09:31 PST 2008
You cannot use pubsub because you will call your main gui in the
thread context of your worker thread. Which is basically the same as
just calling GUI elements from inside your thread. I would suggest
using a thread safe QUEUE where you post data in, and use OnIdle or
any other mechanism to read messages back inside the GUI thread. Also
postevent will work, but then you will use GUI related stuff in a
working thread and it's not really decoupled.
- Jorgen
On Jan 15, 2008 9:55 AM, Frank Aune <Frank.Aune at broadpark.no> wrote:
> On Monday 14 January 2008 23:41:23 Michael Moriarity wrote:
> > Hello Frank:
> > I have had success by using:
> >
> > wx.CallAfter(Publisher.sendMessage,
> > topic='SomeTopic',
> > data=SomeData)
>
>
> But won't this contradict the entire point of pubsub, since you want to keep
> your model separated from wx?
>
> I've tried calling wx.CallAfter on the function performing the GUI update, but
> still the GUI will randomly hang.
>
> Cheers,
>
> Frank
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
More information about the wxpython-users
mailing list