以下代码引发错误:
while True:
event = pygame.event.wait()
if (event.type == ENDSONG):
queue_song()
上面写着:
^{pr2}$我所做的大部分挖掘工作都说错误源于游戏机初始化()没有运行,但这就是我的代码的开始。在
我还缺什么吗?在
编辑:添加代码。在
import pygame
import time
def queue_song():
print "Queueing New Song"
pygame.init()
pygame.mixer.init()
#rest of code
即使初始化Pygame,也需要调用
display.set_mode
以避免此错误:发生这种情况是因为事件队列需要设置视频模式才能正常工作。从documentation:
相关问题 更多 >
编程相关推荐