From: Kevin A. <al...@se...> - 2005-02-27 16:56:29
|
On Feb 27, 2005, at 5:22 AM, Ronny De Winter wrote: > Liam Clarke wrote: > >> def on_Test_mouseClick(self, event): >> print "*** button clicked" >> # why can i not disable the button with: >> self.components.Test.enabled = False >> >> time.sleep(5) >> self.components.Test.enabled = True >> >> Because, you're not repainting in there - alternately, you could use >> wx.timer instead. >> (This is straight copy and paste from the Pythoncard manual.) >> >> You have to force a repaint, iirc, and how do that is >> buried deep within wxPython. >> >> > I tried with > self.components.Test.Update() > > after disabling the button, without success. 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() > > wx.timer is no alternative for me, in fact i don't sleep(5) but do > some processing for about 5 secs (didnt post the whole processing > since it > is not relevant to the problem). 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. > Forcing the repaint is the message, but how ? > How to best explore the deeply buried functionality of > wxPython/wxWidgets ? > Do you use specific tools for that ? published API documentation > on the internet ? dynamic exploration via debuggers, ... ? > > A couple of days ago i posted a similar question about autosizing the > columns of a multicolumnlist. Also there the answer is probably buried > in wxPython/wxWidgets. > What is the fastest way to find the answer to these kind of problems ? > > Best regards, > Ronny De Winter > For wxPython questions, please post your quest on wxPython-users. http://www.wxpython.org/maillist.php ka |