2015-06-02 134 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在您发布的代码中的任何其他地方。