samedi 10 septembre 2016

python tkinter checkbutton value always equal to 0

I put the checkbutton on the text window,but everytime I select the checkbutton,it return 0.

Part of the code is :

def checkbutton_value():

    if(var.get()):
        index_column.append(1)
        print 1
    else:
        index_column.append(0)
        print 0


var=BooleanVar()
chk = Checkbutton(root, text=column_1rowname[1], variable=var, command=checkbutton_value)
text.window_create("end", window=chk)
text.config(state=DISABLED)




Aucun commentaire:

Enregistrer un commentaire