开发者

How to play sound till the user hits a key?

开发者 https://www.devze.com 2022-12-11 04:32 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号