Creating a check button with different initial states
In this recipe, we will add three Checkbutton
widgets, each with a different initial state.
Getting ready
This recipe extends the previous recipes.
How to do it...
We are creating three Checkbutton
widgets that differ in their states. The first is disabled and has a checkmark in it. The user cannot remove this checkmark as the widget is disabled.
The second Checkbutton
is enabled and, by default, has no checkmark in it, but the user can click it to add a checkmark.
The third Checkbutton
is both enabled and checked by default. The users can uncheck and recheck the widget as often as they like.
# Creating three checkbuttons # 1 chVarDis = tk.IntVar() # 2 check1 = tk.Checkbutton(win, text="Disabled", ...
Get Python GUI Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.