I'm trying to make a window that will provide a grid of checkboxes that looks like this: grid of checkboxes 10x10
I've got the following code to create it:
checks = Tk()
checks.title("Check Grid")
value = []
z = 1
for x in range(1,11): # Row
for y in range(1,11): # Column
value.append('')
box = Checkbutton(checks, text = z, variable = value[(z)-1])
box.grid(row = x, column = y, sticky = S)
z += 1
#exit button
def exit():
print(value)
checks.destroy()
Label = Button(checks, text = 'Exit',command = exit).grid(row = 11)
checks.mainloop()
return value`
with this: box = Checkbutton(checks, text = z, variable = value[(x*y)-1])
I'm trying to assign the checkbox value to the z value of the value
list. This doesn't appear to be working, any ideas?
question: How do I make a grid of checkboxes, using tkinter, that send their values to their list index of a single list?
Aucun commentaire:
Enregistrer un commentaire