from Tkinter import *
def main():
root = Tk()
finish = Button(root, command=abcd)
finish.grid(row=0, column=1)
root.mainloop()
def abcd():
global k1
ku = Tk()
k1 = BooleanVar()
b = Button(ku, command=efgh)
s = Checkbutton(ku, variable=k1)
b.grid(row=1)
s.grid(column=1)
ku.mainloop()
return
def efgh():
global k1
print(k1.get())
return
main()
This is a shorter version of a project of mine. I want the code to print "true" when the checkbutton "s" is checked but instead it prints "false", no matter if it is checked or not. I created the two windows on purpose. Where is the mistake?