Disable Checkbutton Tkinter (grey out)
Using state=DISABLED
is the correct way to do this.
However, you must be putting it in the wrong place. state
is an option of Checkbutton
, so it needs to be used like this:
Checkbutton(state=DISABLED)
Below is a sample script to demonstrate:
from Tkinter import Tk, Checkbutton, DISABLED
root = Tk()
check = Checkbutton(text="Click Me", state=DISABLED)
check.grid()
root.mainloop()
If you want to change a checkbutton's state programmatically, use Tkinter.Checkbutton.config
.
Below is a sample script to demonstrate:
from Tkinter import Tk, Checkbutton, DISABLED
root = Tk()
def click():
check.config(state=DISABLED)
check = Checkbutton(text="Click Me", command=click)
check.grid()
root.mainloop()