From: Liam C. <cy...@gm...> - 2005-02-27 03:54:55
|
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.) from wxPython import wx def on_Test_mouseClick(self, event): self.myTimer = wx.wxTimer(self.components.Test, -1) # create a timer self.components.Test.enabled = False self.myTimer.Start(5000) # launch timer, to fire every 5000ms (5 seconds) def on_Test_timer(self, event): self.myTimer.Stop() self.components.Test.enabled = True That's guaranteed to do it for you but it's a bit of a hackish brute way of doing it. You have to force a repaint, iirc, and how do that is buried deep within wxPython. On Sun, 27 Feb 2005 00:00:31 +0100, ronny de winter <ron...@gm...> wrote: > Hello, > > I have a Test button which should perform an action, like sleeping > 5 secs in the example below. During this action the button should not accept > any event. So one should not be able to click the button again before the action > related to the button is finished. During the action any Test button > clicks should > be ignored. > > How can i do that? > Why doe the code below does not show this behavious ? > > 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 > > Ronny De Winter > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. |