0
我得到的代码示例有两个窗口,第二个窗口中有一个勾选框,它在勾选时不会更改值。我怎样才能解决这个问题?我试着返回tickbox的值,但是失败了。如何获取勾选框来更改第二个窗口中的值?
from tkinter import *
root = Tk()
def open_custom_gui():
custom_gui()
b = Button(root,command=open_custom_gui)
b.grid(row=1,column=0)
def custom_gui():
def getinfo():
print(var1.get())
custom= Tk()
var1 = IntVar()
tickbox_1 = Checkbutton(custom,text='TEST',variable=var1,)
tickbox_1.grid(row=0,column=0)
b = Button(custom,command=getinfo)
b.grid(row=1,column=0)
custom.mainloop()
root.mainloop()
非常感谢! –