Sep-20-2020, 04:49 PM
(This post was last modified: Sep-20-2020, 04:58 PM by deanhystad.)
I would not use callbacks for the Checkbuttons at all. Checkbuttons have a value, so there is no reason to make another variable just to keep the checkbutton's value. The value of the Checkbutton is avialable through the tkinter variable you bound to the Checkbutton's var. Keep those in a list and use the list to get (or set) the values for all the Checkbuttons.
When you press the search button the callback would scan through all the checkbutton variables and add the associated name to the search when the checkbutton is pressed. Maybe it would be better to make the checkbuttons True/False and bind to a BooleanVar.
When you press the search button the callback would scan through all the checkbutton variables and add the associated name to the search when the checkbutton is pressed. Maybe it would be better to make the checkbuttons True/False and bind to a BooleanVar.
for index, checked in enumerate(checkbutton_vars): if checked.get(): add_name_to_search(index)