I'm fairly new to Tkinter. I've tried creating a class for a GUI I'm creating and I've bumped into an error which I am unable to fix. Ive been through other forums and tried different ways of amending the error but had no luck. Code:
root1 = Tk() root1.geometry("800x500") class simulation: def __init__(self, root1): radius_input = Label ( root1 , text="Radius: " ) direction_input = Label ( root1 , text="Direction (clockwise=1/\n anticlockwise=2): " ) radius_entry = Entry ( root1 ) direction_entry = Entry ( root1 ) #####other code used to display labels and entry boxes self.radius = radius_entry self.direction = direction_entry self.pos_neg = 0 if self.direction == 1: self.pos_neg = (-6.28) elif self.direction == 2: self.pos_neg = (6.28) def actual_sim(self): r = self.radius #radius of the circle the ball moves t = 1 omega = self.pos_neg / t # amount/angle the ball moves each second #####other code not needed xposition = (r * cosValue) yposition = (r * sinValue)
the error i get is:
xposition = (r * cosValue) TypeError: unsupported operand type(s) for *: 'instance' and 'float'
i dont understand what this means or how to fix it. Any ideas anyone??