Jun-16-2017, 03:34 PM
Hello. So I am trying to create a radiobutton that changes the value of another variable when clicked on. Obviously I'm missing something, because no values are changing. Here's the code:
EDIT:
Here is my output:
from tkinter import * root = Tk() iv1 = IntVar() iv1.set(1) var = IntVar() var.set(0) rb1 = Radiobutton(master=root, value=iv1, variable=var) rb1.pack() num = var.get() print(var.get()) root.mainloop() print(num)In my project, I will want to have four radiobuttons instead of one, but this is just a simple code that shows you the error I'm having. At the end, print(num) should give 1, but instead it equals 0. Any idea why? Thanks in advance.
EDIT:
Here is my output:
0 0