jeudi 1 décembre 2016

How can i get the tick boxes to change value in the second window?

I got example code were there are two windows and in the second one theres a tick box that dosen't change value when it is ticked. How can i fix this ? I tried returning the value of the tickbox however that failed as well.

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()




Aucun commentaire:

Enregistrer un commentaire