Professional Documents
Culture Documents
Checkbuttondemo Py
Checkbuttondemo Py
# Create a function to update the label text when a check button is toggled
def update_label():
selected_options = []
for text, var in zip(option_texts, selected_options_vars):
if var.get():
selected_options.append(text)
selected_option_text.set("Selected options: " + ', '.join(selected_options))
# Create a list to store the selected options as BooleanVars and their corresponding texts
selected_options_vars = []
option_texts = ["Option 1", "Option 2"]