| | |
Interrupt Sleep function
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
So far I have only found one function that will work during the active sleep() ...
Edit:
Ouch! The IDE fooled me! This does not make sense, forget it! Sorry!
Python Syntax (Toggle Plain Text)
import time import msvcrt time.sleep(10) # prints the key value during sleep if msvcrt.kbhit(): print msvcrt.getch()
Ouch! The IDE fooled me! This does not make sense, forget it! Sorry!
May 'the Google' be with you!
havn't got an example, but my very rough guess is maybe you could do something along the lines of;
wrap a function around the time.sleep() function that when called it starts the sleep in another thread so that the program will only continue untill;
sleep ends,
thread gets killed (stoppped)
so the way to interrupt could be to manually shut down the thread which in turn would shut down the sleep
OR
you could make your own sleep class that allows you to kill it?
something along those lines anyway
not too experienced on threading or using classes
wrap a function around the time.sleep() function that when called it starts the sleep in another thread so that the program will only continue untill;
sleep ends,
thread gets killed (stoppped)
so the way to interrupt could be to manually shut down the thread which in turn would shut down the sleep
OR
you could make your own sleep class that allows you to kill it?
something along those lines anyway
not too experienced on threading or using classes
![]() |
Similar Threads
- Python Sleep Function: (Python)
- What is sleep function (Perl)
- Help: need feedback on my Java assignment about thread sleep. It's already coded. (Java)
Other Threads in the Python Forum
- Previous Thread: what does an IDE really do?
- Next Thread: Python as a first language
| Thread Tools | Search this Thread |
Tag cloud for Python
alarm assignment avogadro beginner bluetooth character cmd code copy customdialog cx-freeze data decimals dictionary directory dynamic error examples excel exe file float format ftp function generator gnu graphics gui halp homework http ideas import input itunes java leftmouse line linux list lists logging loop module mouse number numbers output parsing path port prime program programming projects push py2exe pygame pyglet pyqt python random recursion recursive schedule screensaverloopinactive script scrolledtext slicenotation sqlite ssh stdout string strings sudokusolver table terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode update urllib urllib2 variable ventrilo verify vigenere webservice wikipedia windows wxpython xlib







