PyGame混音器不起作用

时间:2016-07-07 08:59:07

标签: python python-3.x pygame pycharm

我试图在我的教科书中使用这些代码,但事实并非如此。 我正在使用Windows 8.1并为PyCharm安装了pygame

import pygame
sounds = pygame.mixer
sounds.init()

def wait_finish(channel):
    while channel.get_busy():
        pass

s = sounds.Sound("heartbeat.wav")
wait_finish(s.play())
s2 = sounds.Sound("buzz.wav")
wait_finish(s2.play())
s3 = sounds.Sound("ohno.wav")
wait_finish(s3.play())
s4 = sounds.Sound("carhorn.wav")
wait_finish(s4.play())

执行脚本时,它说:

C:\Users\dasom\AppData\Local\Programs\Python\Python35-32\python.exe 
C:/Users/dasom/PycharmProjects/untitled/ready.py
Traceback (most recent call last):
  File "C:/Users/dasom/PycharmProjects/untitled/ready.py", line 2, in <module>
    sounds = pygame.mixer
AttributeError: module 'pygame' has no attribute 'mixer'

似乎pygame模块中没有混音器。我该如何解决这个问题?

0 个答案:

没有答案