简体   繁体   English

Pygame无法正确退出

[英]Pygame not quitting properly

Lately my game did not stop when I called my routine to exit. 最近,当我调用例程退出时,我的游戏没有停止。

In various tests I could narrow the error down to when pygame.quit() is called. 在各种测试中,我可以将错误范围缩小到调用pygame.quit()时。 At this moment the program freezes. 此时程序冻结。 I wrote a short program to verify that it was not anything funky in my code: 我写了一个简短的程序来验证它在我的代码中没有什么时髦:

import pygame
pygame.init()
pygame.quit()

This resulted in the same error. 这导致了同样的错误。

I use python 2.7.6 and pygame 1.9.1release on Ubuntustudio 14.04.4 LTS and not Idle 我在Ubuntustudio 14.04.4 LTS上使用python 2.7.6pygame 1.9.1release不是空闲

Edit1: EDIT1:

No Error is risen. 没有错误出现。 With error I mean that the program does not stop as expected rather then just idles around. 出现错误时,我的意思是该程序没有按预期停止,而是闲置了。 My guess is that some async process is still running in pygame. 我的猜测是pygame中仍在运行一些异步进程。

Are you running this in idle? 您是否在闲置运行? If so, idle generally requires the shell window to close before the pygame window will close. 如果是这样,闲置通常需要在pygame窗口关闭之前关闭shell窗口。 Try running the program directly through terminal if you haven't already. 如果还没有,请尝试直接通过终端运行该程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM