I've spent pretty much time on this problem, and I still can't get the point. I have two windows, the second one opens when I press the button in the first one. Both windows contain checkboxes. Both have callback functions that print out the state of the checkbox. Why it works for the first window, and does not for the second one? Here is the sample code:
from tkinter import *
def callback():
print (Var1.get())
def open_window():
def callback2():
print(Var2.get())
root = Tk()
root.lift()
frame = Frame(root)
frame.pack()
Var2 = IntVar()
Chkbox2 = Checkbutton(frame, text="Check2", variable=Var2, command=callback2)
Chkbox2.pack()
root = Tk()
root.lift()
frame = Frame(root)
frame.pack()
Var1 = IntVar()
Chkbox1 = Checkbutton(frame, text="Check1", variable=Var1, command=callback)
Chkbox1.pack()
Button = Button(frame, text='Open', command=open_window)
Button.pack()
root.mainloop()