From: Ronny De W. <ron...@gm...> - 2005-02-27 19:57:50
|
Kevin, Thanks, using redraw() and Yield() solved my problem: def on_Test_mouseClick(self, event): if self.loading: return self.loading = True print "*** button clicked" self.components.Test.enabled = False self.components.Test.redraw() time.sleep(5) wx.Yield() self.loading = False self.components.Test.enabled = True Cheers/ rdw Kevin Altis wrote: > Try Test.redraw(), the redraw method was made specifically for this > purpose. The method is defined in widget.py > > def redraw(self): > """Force an immediate redraw without waiting for an event > handler to finish.""" > self.Refresh() > self.Update() > > Actually, I think using a timer is the right way to reenable the > button. You may also need to consider calling SafeYield() depending on > how responsive you want the UI to be during your processing. There are > many samples that do long processing, so take a look at them for more > examples. |