python3.3 IDLE中通过点击×来关闭窗口,要怎么写?

我在书里看到是
import pygame, sys
pygame.init()
screen = pygame.display.set_mode([640,480])
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
但是我试了没有效果,系统提示了一段
Traceback (most recent call last):
File "D:\Software\Python\Making a Pygame window.py", line 7, in <module>
sys.exit()
SystemExit
但是窗口还在

不要用exit或者quit,只是退出进程,试下destroy,
温馨提示:答案为网友推荐,仅供参考
相似回答