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 independ开发者_JS百科ent way of doing this?
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.
Can you be more specific? This could be done in pygame, but you'd need to open a graphical window.
精彩评论