2017-04-25 62 views
0

错误读取:为什么这个系统错误出现?

File "FinalProject.py", line 81 
    if e.type == QUIT: raise SystemExit, "QUIT" 
            ^
SyntaxError: invalid syntax 

我对行的代码如下所示:

for e in pygame.event.get(): 
     if e.type == QUIT: raise SystemExit, "QUIT" 
+4

的语法是2.x的,但它似乎您试图在3.X – Wondercricket

+4

运行'提高SystemExit(“退出”)'? – kindall

+0

@kindall工作感谢! – voldemort

回答

0

我假设你想启用退出按钮。 您需要以不同的格式编写此文件。 试试这个,

for event in pygame.event.get(): 
    if event.type == QUIT: 
     pygame.quit() 
     sys.exit() 
     print 'Ending Program' 
+0

我所要做的就是加括号。感谢您的帮助! – voldemort

相关问题