所以我尝试使用Tkinter接收文本输入,然后运行pygames来制作动画。但是当我关闭Pygames时,我得到了一个错误。在
我计划如何使用Pygames的简化版本:def the_program():
if spot.get().strip() == "":
tkMessageBox.showerror("X", "Y")
else:
code = spot.get().strip()
pygame.init()
pygame.display.set_caption('X')
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
运行Tkinter:
^{pr2}$
Pygames打开很好,运行也很好,但是当我关闭它时,我得到了一个错误:Traceback (most recent call last):
File "C:\Python26\Practice\legit Battle Master.py", line 82, in
root.mainloop()
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1017, in mainloop
self.tk.mainloop(n)
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1412, in __call__
raise SystemExit, msg
我怎样才能避免这种情况?我试着去掉“系统出口(),但python崩溃了。在