[wxPython-users] Updating GUI from sub-threads
Frank Aune
Frank.Aune at broadpark.no
Fri Apr 27 13:15:26 PDT 2007
On Friday 27 April 2007 18:25:00 Josiah Carlson wrote:
> Yes, there is a method of acquiring and releasing the GUI lock which
> would allow you to do everything from a sub thread.
>
> wx.MutexGuiEnter()
> try:
> #do GUI updates
> finally:
> wx.MutexGuiLeave()
>
> I personally prefer wx.CallAfter().
>
>
> Regardless of whether you use wx.CallAfter, or the MutexGui operations,
> you can do as many GUI operations as you want in the function called by
> wx.CallAfter or between the Enter/Leave calls.
Ah, Ive tried acquiring the GUI mutex before and it works as you describe on
both Mac and Windows. However, I have yet to make this work for GNU/Linux. I
just tried again with both wx.CallAfter and wx.MutexGuiEnter/wx.MutexGuiLeave
and both will make the GUI hang under GNU/Linux.
Getting alot of:
Xlib: unexpected async reply (sequence 0x10300)!
And this has always indicated a direct access to the main loop from subthreads
for me. I know its impossible for you to debug any more without access to the
code, but do you know why I might see these differences?
Regards,
Frank
More information about the wxpython-users
mailing list