开发者

Python/Tkinter Audio Player

开发者 https://www.devze.com 2023-01-01 07:59 出处:网络
I\'m developing a media player. Right now it\'s a simple window with a button to load .wav files. The problem is I would like to implement a pause button now. But, when playing a audio file the GUI is

I'm developing a media player. Right now it's a simple window with a button to load .wav files. The problem is I would like to implement a pause button now. But, when playing a audio file the GUI isn't accessible again (no buttons can be pushed) till the file is done playing. How can I make the GUI dynamic while an audio file is playing?

开发者_StackOverflow中文版

I'm using PyAudio, and their implementation doesn't allow this.


Probably you have to use threads for that. You have to play your audio file in a different thread than the gui mainloop so that the GUI keeps responding user input.

IMHO, wxpython is not so complicated and has some utility functions that would help to do what you want. Check the wxpython demo, you have several examples there.


You can alternatively use pygame mixer for the purpose , I made the same in pyqt and I did'nt require to implement threading . You can get the documentation of pygame mixer at https://www.pygame.org/docs/ref/mixer.html Happy Coding .


Try this out: Check the code https://drive.google.com/file/d/0B7ccI33Aew5fNVhwZ2puYTBuUFU/view?usp=sharing I have used pygame also.Hope this helps.

0

精彩评论

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

关注公众号