Start the playback of the music stream play(loops=0, start=0.0) ->
None This will play the loaded music stream. If the music is already
playing it will be restarted.
The loops argument controls the number of repeats a music will play.
play(5) will cause the music to played once, then repeated five times,
for a total of six. If the loops is -1 then the music will repeat
indefinitely.
^{} 从事件队列返回单个事件,但它不会等到音乐播放完毕。} 并等待特定的时间:
您必须使用^{
另一种选择是使用^{} 并在循环中等待音乐结束:
你写的东西不清楚,但我猜你的computersong.mp3是20秒,它正在播放到结束并停止。假设是这种情况,并且您希望它重复,您可以尝试以下方法:
从pygame文档here中,您可以看到,如果希望重复歌曲,可以为循环参数指定一个值。如果你想让它继续循环直到你停止它,那么你就通过playloop=-1
然后,您的代码需要继续执行其他操作。如果程序只是这样做然后退出,它当然会停止
相关问题 更多 >
编程相关推荐