2014-03-30 155 views
0

如果答案很明顯,但是出於某種原因,下面的代碼在def _ _ init __ block後面的每一行都會給我一個語法錯誤,我表示歉意。 如果我只是註釋掉init,整個程序工作正常。使用__init__時出現語法錯誤

import graphics 
from graphics import * 


class Block: 

    def __init__(self,x,y,win,fid,length,orien,colour): 

     wind = win 
     if (orien == "horizontal"): 

      topL,dump = getPoint(fid) 

      lightRect = Rectangle(getPoint(fid) 


    #  else: 
    #   x =5 



    def draw(self): 
     return   


    def undraw(self): 
     return 


    def highlight(self): 
     return 


    def unhighlight(self): 
     return 


    def switchHighlight(self): 
     return 

    def move(self,target): 
     return 

任何幫助將不勝感激!

+0

'類塊:'應該是'類塊():'並跟蹤壓痕。它需要一致4個空格。當然,正如mchfrnc所提到的,語法錯誤。 – karthikr

回答

5

缺少 「)」 中:

lightRect = Rectangle(getPoint(fid) 
+0

謝謝!我認爲這可能太明顯了...... DX – user3479195

相關問題