0

I'm developing a rather big GUI with Tkinter for my cocktail-robot and now I'm trying to disable the mouse for a few seconds, so that no click on the screen will cause any event. The reason why I need to do this is that the programm crashes if there're to much incoming events. Because I'm using time.sleep() for a few seconds, Windows thinks that the programm crashed and asks whether it should be closed.

Is there any possibilty to do that? Can I just bind the whole screen to "< Button-1 >"

Btw. the GUI is based on this structure: Switch between two frames in tkinter

I'm looking forward to your help! Thanks

Community
  • 1
  • 1
user2304540
  • 101
  • 1
  • 2
  • 8
  • See if this helps: http://stackoverflow.com/questions/15042221/how-can-i-disable-mouse-control-of-a-tkinter-listbox – Al.Sal Aug 16 '13 at 13:18
  • I have a suggestion. If `time.sleep()` is making your program lock up, then don't use `time.sleep()`. – Kevin Aug 16 '13 at 13:23
  • @Kevin: What other method can I use to make a function wait for x seconds? – user2304540 Aug 16 '13 at 14:47
  • That depends. Why do you want it to wait? If I was the user, I would prefer that all computations finish as quickly as possible. I don't want to twiddle my thumbs while the application pretends to do work. – Kevin Aug 16 '13 at 15:03
  • You should never use `time.sleep()` in a GUI, because it makes the entire GUI unresponsive. – Bryan Oakley Aug 16 '13 at 16:16
  • Thank you for your answers, but I still don't get it done. I need the programm to wait because I'm opening some valves and then after a certain time (here I'm using time.sleep()) I'm closing them. Is there a better way to do that? – user2304540 Aug 17 '13 at 13:16
  • Okay I did it using self.after(ms, callback)... sorry for not reading the events and bindings section on effbot very precisely. Thanks guys – user2304540 Aug 17 '13 at 13:31

0 Answers0