代码加载了一个pygame屏幕窗口,但是当我单击X关闭它时,它会变得无法响应.我正在运行64位系统,使用32位python和32位pygame.
from livewires import games, color
games.init(screen_width = 640, screen_height = 480, fps = 50)
games.screen.mainloop()
Run Code Online (Sandbox Code Playgroud)
Mach1723的答案是正确的,但我想建议一个主循环的另一种变体:
while 1:
for event in pygame.event.get():
if event.type == QUIT: ## defined in pygame.locals
pygame.quit()
sys.exit()
if event.type == ## Handle other event types here...
## Do other important game loop stuff here.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6875 次 |
| 最近记录: |