First thought of implementing this using threads but python doesnt have a way for killing threads. I have read the other topic on killing threads. Is there any proper platform independent way of doing this?
A:
Can you be more specific? This could be done in pygame, but you'd need to open a graphical window.
Jeffrey Aylesworth
2009-11-13 21:19:39
A:
I think you'd better use a Tk timer for ringing periodically, and then stop it when you get the key press.
See http://www.java2s.com/Code/Python/GUI-Tk/Clockevent.htm for an example how to use timer.
Thus you will avoid creating another thread.
EFraim
2009-11-13 21:26:16
Is it possible to stop the timer after getting a keypress? http://python.active-venture.com/lib/timer-objects.html - Here I find that you can stop the timer only before the action starts.
dante
2009-11-13 21:45:21
@dante: you can just not reactivate it. (not call .after)
EFraim
2009-11-13 21:49:23
http://code.activestate.com/recipes/492231/- This helped me.
dante
2009-11-14 00:33:51