You can’t directly manipulate the GUI anywhere but within the main thread, because its got an event loop that’s cycling around happily and it expects to be able to maintain its state consistently.
You can use “wx.CallAfter” to easily invoke GUI-manipulation int he main thread.
E.g., instead of “enableSearchButton( self._button )” you can “wx.CallAfter(enableSearchButton, self._button)” which will make the previous call in the main thread on the next hit of the event loop.
···
On 8/14/07, Robert Dailey rcdailey@gmail.com wrote:
Hi,
I’m currently using the threading.Thread class to provide multithreading my wxPython app. I have a class that derives from threading.Thread. This class owns a threading.Event object which my overridden join() calls set() on to signal the run() loop to exit. Immediately after that I call the base class join(). Now, if in my run() loop I call into wx.Button.SetLabel(), the join() call deadlocks my main thread. However, if I comment out any wxPython calls the run() loop exits without any hanging. The source code is below. Can anyone tell me what I’m doing wrong?