【发布时间】:2013-03-19 05:34:31
【问题描述】:
如果标题不够清晰,目录中有 Developer/Pythonfiles/Pong,其中有 Pong.py 和 hit.wav。
当我运行~ $python Developer/Pythonfiles/Pong/Pong.py
声音 hit.wav 不会播放,而是播放奇怪的爆裂声。
但是当我运行~/Developer/Pythonfiles/Pong $python Pong.py 时,hit.wav 的声音会按预期播放。
为什么程序 Pong.py 不搜索它所在的目录而不是我的工作目录来查找 Hit.wav?我尝试使用hit = pygame.mixer.Sound("hit.wav") 访问hit.wav 并使用hit.play() 播放它
【问题讨论】:
-
贴出你的代码,你可以得到不靠猜测的答案。
标签: python python-2.7 terminal pygame