I am trying to make a basic drawing program with a RadioButton to determine shape of the brush.
self.choseo = Radiobutton(text='Circle', variable=shape,indicatoron=0, value=1)
self.choser = Radiobutton(text='Rectangle', variable=shape,indicatoron=0, value=2)
self.chosea = Radiobutton(text='Arc', variable=shape,indicatoron=0, value=3)
Which corresponds to:
if shape.get()==3:
self.display.create_arc( self.x1, self.y1, self.x2,
self.y2, fill = mycolor, outline= mycolor, tags = "line")
elif shape.get()==2:
self.display.create_rectangle( self.x1, self.y1, self.x2,
self.y2, fill = mycolor, outline= mycolor, tags = "line")
elif shape.get()==1:
self.display.create_oval( self.x1, self.y1, self.x2,
self.y2, fill = mycolor, outline= mycolor, tags = "line")
When i run this i get this error:
"TypeError: get() takes exactly 1 argument (0 given)"
How do i make this work?
You didn’t tell what
shapeis, but you should make sure your use an instance ofIntVar.Try the following code:
and
shape.get()will work the way you want.