2015-06-02 133 views
-2

我已經在那裏我不斷收到此錯誤的Tkinter程序:的Python的Tkinter屬性錯誤

File "F:\Programming 2\Gui\Gui #11.py", line 78, in shape_workit 
cylinder(pos=(0,0,0),axis=(1,0,0),color=self.color3.get(), 

AttributeError: 'Kinter' object has no attribute 'color3' 

下面是發生錯誤從代碼:

def shapescolor(self): 
    if self.color1.get()=="Does a Orange": 
     color3=color.orange 
    if self.color1.get()=="Does a Blue": 
     color3=color.blue 
def shape_workit(self): 
    try: 
     if self.shape.get()=="Does a Cylinder":       #Creates Cylinder 
      cylinder(pos=(0,0,0),axis=(1,0,0),color=self.color3.get() ##ERROR HERE, 
        radius=float(self.radius.get())) 

這裏是代碼,其中錯誤它從

回答

1

我的猜測是,你需要做self.color3 = ...而不是color3 = ...,因爲你後來提到self.color3,並沒有設置th在您發佈的代碼中的任何其他地方。