Hey guys,
I've been fiddling around with Tkinter for a bit and can't for the love of me figure out why this code won't work. I'm making a GUI that outputs the price of a product depending on what buttons the user pressed. I have three calculations that revolve around the buttons pressed and no matter what button I press, the same value is outputted.
I start the code by defining the two values I want the user to be able to dictate.
d = 0
n = 0
Now I make a button and I want it so that when the user clicks this button, the value of d is changed.
def d1():
d = 10
d1 = Button(text="Click Me", command=d1).pack()
Likewise, the same applies for the other variable.
def n1():
n = 1
n1 = Radiobutton(root, text="Click me!", variable=n1).pack()
Theoretically, when I click these buttons or d2, n2, d3, n3... the stock value of d and n which have been posted at the top should change allowing the calculation to process a different result and the value output to be different.
Hope you can help, thanks.