2017-04-25 63 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

相關問題