Hi all,
Being pretty new to wxPython (and python in general) it was recommended to insert a wxYield into some code that I had inherited to maintain:
class FooClass(threading.Thread)
…
[ the thread this manages the GUI]
self.foo = FooClass()
self.foo.daemon = True
–> proposed wx.Yield() here <—
self.foo.longRunningFunc()
self.foo.start()
The logic behind the suggestion would it would help the GUI be more responsive. But to me it would seem more elegant to rearrange the code so that we don’t call longRunningFunc() until after starting the background thread. Also it seemed strange to call functions in another thread directly- thinking it would be better to use some kind of messaging system (pubsub maybe) to alert the background thread to do some work.
Any thoughts?
Hi Cody,
Ok thanks for confirming what I suspected.
Cheers,
pat
···
On Thursday, February 21, 2013 1:19:44 PM UTC-7, patrick korsnick wrote:
Hi all,
Being pretty new to wxPython (and python in general) it was recommended to insert a wxYield into some code that I had inherited to maintain:
class FooClass(threading.Thread)
…
[ the thread this manages the GUI]
self.foo = FooClass()
self.foo.daemon = True
→ proposed wx.Yield() here <—
self.foo.longRunningFunc()
self.foo.start()
The logic behind the suggestion would it would help the GUI be more responsive. But to me it would seem more elegant to rearrange the code so that we don’t call longRunningFunc() until after starting the background thread. Also it seemed strange to call functions in another thread directly- thinking it would be better to use some kind of messaging system (pubsub maybe) to alert the background thread to do some work.
Any thoughts?