我制作了一个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()))
下面是错误的来源代码
我的猜测是您需要执行
self.color3 = ...
而不是color3 = ...
,因为您稍后引用了self.color3
,并且在发布的代码中没有在其他任何地方设置该属性相关问题 更多 >
编程相关推荐