0

No matter what I do, the window will never quit on QUIT event. It would either ignore me pressing the X button or go into "Not responding" mode. I usually restart the shell and then force close it from the Windows.

None of these methods work and not even all of them together.

for event in pygame.event.get():
    if event.type == QUIT:
        done = True
        sys.exit(0)
        raise SystemExit
        break
4

1 回答 1

2

尝试pygame.quit()

import pygame
from pygame.locals import *

Clock = pygame.time.Clock()
Display = pygame.display.set_mode((100,100))

Running = True

while Running:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            Running = False
            sys.exit()
            break

    Clock.tick(30)
于 2013-05-29T17:43:03.323 回答