python pygame-pygame.mixer.pause()无法正常运行

时间:2018-12-02 11:53:25

标签: python pygame

我有这段代码,可以使用pygame循环运行声音

def sound_alarm(path):
    pygame.mixer.init()
    pygame.mixer.music.load(path)
    pygame.mixer.music.play(-1)

然后我使用线程通过

调用它
 # check to see if an alarm file was supplied,
 # and if so, start a thread to have the alarm
 # sound played in the background
 if args['alarm'] != '':
    t = Thread(target=sound_alarm,
        args=(args['alarm'], ))
    t.daemon = True
    t.start()

但是当我尝试使用

pygame.init()
pygame.mixer.pause()

声音没有停止并且没有显示错误  如何解决这个问题。预先感谢

0 个答案:

没有答案