question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CheckButton's ON state while it is disabled

See original GitHub issue

Is your feature request related to a problem? Please describe.

When setting the state of a CheckButton to DISABLED, the “tick” disappears from the CheckButton as its variable would have the offvalue value. A small reproducer:

import ttkbootstrap as ttk

app = ttk.Window()

frame = ttk.Frame(app)
frame.pack()

value = ttk.StringVar()
value.set("1")
ttk.Checkbutton(frame, text=f"Checkbutton", state=ttk.DISABLED, variable=value, onvalue="1", offvalue="0").pack()

app.mainloop()

Describe the solution you’d like

I would like a DISABLED state for the CheckButton that properly indicates the state of its value(properly grayed out when the state is on).

Describe alternatives you’ve considered

My workaround was not setting the CheckButton to DISABLED. Instead, I bound a callback function for the toggling. In the callback function, I set the bounded value manually to its previous value (if I want the button to be disabled) so the user feels like the button is actually disabled.

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
israel-dryercommented, Apr 20, 2022

light theme results python_MRaDGnnOX1

dark theme results python_RyxR3yjrxe

1reaction
atban98commented, Apr 20, 2022

@israel-dryer, that’s pretty good, but I would prefer something like this: 164143088-362a1ad5-21c4-4283-b7ef-b76b52e908c3 It gives me more the “disabled-selected” feeling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to check the state (enabled/disabled) of a checkbox in ...
I have a program I am writing in Python and I'm having trouble with checking the state of a checkbox. I do NOT...
Read more >
Make checkbox disabled based on case's state value
I created a custom widget to show cases in list view with checkboxes. I want to make the respective checkbox enabled only if...
Read more >
How to disable checkbutton Tkinter (grey out)? - Tutorialspoint
We can make a widget either active or disabled whenever required. To disable the Checkbuttons widget, we have to set the state property...
Read more >
Python Tkinter for GUI programs Checkbutton Check UnCheck ...
Enable or Disable Checkbutton. By using config we can manage the state option of the Checkbutton. Enable disable Checkbutton c1.config(state='disabled') # ...
Read more >
Tkinter Checkbutton reading the Checked or Unchecked value ...
Tkinter Checkbutton reading the Checked or Unchecked value & setting the state to disabled or enable.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found