how to interrupt time.sleep ?
I have line time.sleep(60) in my code How do I cancel waiting 60 seconds if I want to continue with program imediately ? Like Press some button if you don't want to wait If it can't be canceled what's the other solution to wait certain time/or press any button to continue problem ? -- http://mail.python.org/mailman/listinfo/python-list
Re: how to interrupt time.sleep ?
BOOGIEMAN wrote: I have line time.sleep(60) in my code How do I cancel waiting 60 seconds if I want to continue with program imediately? Like Press some button if you don't want to wait You cannot. If it can't be canceled what's the other solution to wait certain time/or press any button to continue problem ? Generally you can just use a much shorter sleep time, and a loop that checks for the condition which interests you. while True: if userWantsToContinue(): break time.sleep(0.25)# wait a short time The implementation of userWantsToContinue() depends of course on what you want it to do. If you need help with that, be sure to indicate what platform you're on so the answers can be meaningful if the solution (as is likely in this case) is not platform- independent. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: how to interrupt time.sleep ?
BOOGIEMAN [EMAIL PROTECTED] writes: I have line time.sleep(60) in my code How do I cancel waiting 60 seconds if I want to continue with program imediately ? Like Press some button if you don't want to wait If it can't be canceled what's the other solution to wait certain time/or press any button to continue problem ? On windows at least, pressing ^C interrupts time.sleep(). print Press ^C if you don't want to wait try: time.sleep(60) except KeyboardInterrupt: pass Thomas -- http://mail.python.org/mailman/listinfo/python-list