【发布时间】:2015-03-23 23:16:48
【问题描述】:
我有一些简单的代码可以在 Python 3.4 中使用 PyGame 播放声音。
import pygame
file = 'Henesys.ogg' # this file exists in current directory
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(0)
pygame.event.wait()
但是,当我运行它时,它不起作用。在 IDLE 中运行时,解释器外壳不再是反应式的(如预期的那样),但没有声音播放。我不确定为什么。我在互联网上搜索,发现人们可以毫无问题地运行此代码。我无法确定问题可能出在哪里。
谁能告诉我我做错了什么?
作为参考,我的操作系统是 Windows 7 64bit,安装了 Python 3.4.3 和 Pygame(从 wheel 安装:pygame-1.9.2a0-cp34-none-32.whl)。
也供参考,platform.architecture() 返回 ('32bit', 'WindowsPE')。
谢谢。
【问题讨论】: