2

I have created a list of 20 check buttons for my last application using Tkinter, but I can't figure out the way to check if a Checkbutton is or not checked.

How do I check if a Checkbutton is checked?

nbro
  • 15,395
  • 32
  • 113
  • 196
Yu Zhang
  • 2,037
  • 6
  • 28
  • 42

1 Answers1

2

Take a look at this answer: Making Menu options with Checkbutton in Tkinter?

For each of the menu item, you need to create and associate a tk.BooleanVar() that matches the status of the checkbox.

Since you have a lot of check buttons, you might want to create a list or dictionary to store these BooleanVars and associate each of them with its own Checkbutton.

Community
  • 1
  • 1
zehnpaard
  • 6,003
  • 2
  • 25
  • 40