Python Threading.Timer Executes Immediately
-
Hi there, I'm writing a small(ish) Python app that is designed to play a list of sounds. Ever seen QLab? A bit like that. The problem I have is this: I have a threading.Timer that (at the moment) prints to the console that a sound has finished playing - it will change the UI, eventually, but the printout is all I need for now - but the timer does not wait until the interval is complete before it fires the function. Code:
playout_1_timer = threading.Timer(10.0,musicDone)
playout_1_timer.start()def musicDone():
print "Music finished playing"However, the timer does not wait the 10 seconds as it should, and calls musicDone as soon as .start() is called. What's going on? Thanks, icemclean
-
Hi there, I'm writing a small(ish) Python app that is designed to play a list of sounds. Ever seen QLab? A bit like that. The problem I have is this: I have a threading.Timer that (at the moment) prints to the console that a sound has finished playing - it will change the UI, eventually, but the printout is all I need for now - but the timer does not wait until the interval is complete before it fires the function. Code:
playout_1_timer = threading.Timer(10.0,musicDone)
playout_1_timer.start()def musicDone():
print "Music finished playing"However, the timer does not wait the 10 seconds as it should, and calls musicDone as soon as .start() is called. What's going on? Thanks, icemclean