我正在制作这个游戏,我希望它在我关闭窗口时退出。现在它工作得很好。窗户没有任何挣扎地关闭。但是,脚本本身继续运行,我不知道为什么。这是结束游戏的代码,我不明白为什么它不会杀死一切。有什么帮助吗?
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.running = False
pygame.quit()
quit()
sys.exit()
答案 0 :(得分:1)
你做了吗
import sys
在你的脚本中?