且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python:在后台播放音乐?

更新时间:2023-12-04 08:45:58

根据

According to the documentation you use the SND_ASYNC flag.

winsound.SND_ASYNC 
Return immediately, allowing sounds to play asynchronously.

要停止播放,请使用NONE参数调用PlaySound.

To stop playing, call PlaySound with a NONE argument.

winsound.PlaySound(None, winsound.SND_ASYNC)