Sep-19-2020, 07:30 AM
Pages: 1 2
Sep-19-2020, 12:43 PM
Instead of having a callback for the checkbox and a list for saving the checkbox state, why don't you just use the tkinter variable? The code below makes 8 checkboxes and collects all their state when some other even (in this case a button press) occurs.
from tkinter import * def complete_form(): for i, var in enumerate(scratched): print(i, var.get()) root = Tk() scratched = [] for i in range(8): var = BooleanVar() scratched.append(var) button = Checkbutton(root, text = str(i), variable = var, onvalue = True, offvalue = False) button.grid(row=i, column=0) button = Button(root, text = "Accept", command=complete_form) button.grid(row=8, column=0) mainloop()
Output:0 True
1 False
2 False
3 True
4 False
5 False
6 False
7 True
Sep-19-2020, 10:43 PM
Thank you so much Dean. I truly appreciate the help. I will in fact do it your way. Awesome. Program logic is a weakness of mine for sure.
Thanks Again.
Thanks Again.
Pages: 1 2