Skip to content Skip to sidebar Skip to footer

Python Tkinter Check Button Printing PY_VAR0

So this is the code, which draws heavily from this question: How do I create multiple checkboxes from a list in a for loop in python tkinter. from tkinter import * root = Tk()

Solution 1:

remove the enable[machine] = Variable()

for machine in enable:
    l = Checkbutton(root, text=machine, variable=enable[machine],
                    command=  actright(machine))
    l.pack(anchor = W)

root.mainloop()

You see PY_VAR0 and PY_VAR1 because you set the values to those with enable[machine] = Variable(), that overwrites the values in your dict so it makes sense that you get the output you do.


Post a Comment for "Python Tkinter Check Button Printing PY_VAR0"