我在尝试Making Games with Python & Pygame书中的一些基本示例,但我面临一个奇怪的问题。以下是示例源:
import pygame, time
soundObj = pygame.mixer.Sound('beep.wav')
soundObj.play()
time.sleep(1) # wait and let the sound play for 1 second
soundObj.stop()
此源产生以下错误:
Traceback (most recent call last): File "C:/Users/Thiago/PycharmProjects/PyGame/Sound/app.py", line 3, in soundObj = pygame.mixer.Sound('beep.wav') pygame.error: Unable to open file 'beep.wav'
beep.wav文件正确保存在Python脚本的同一文件夹中。我试过os.listdir()
命令,它返回wav文件。有什么问题,已知的错误还是我做错了什么?
这是我的环境:
目前没有回答
相关问题 更多 >
编程相关推荐