How to disable checkbutton Tkinter (grey out)?

TkinterServer Side ProgrammingProgramming

The state property in Tkinter is used to change the state of any specific widget. We can make a widget either active or disabled whenever required. To disable the Checkbuttons widget, we have to set the state property as readonly or disabled. Changing the state will make all the checkbuttons inactive during the execution of the program.


#Import the required Libraries
from tkinter import *
from tkinter import ttk

#Create an instance of Tkinter frame
win = Tk()
#Set the geometry of Tkinter Frame

#Add a Top widget
Label(win,text= "Select an Option from the Menu", font=('Aerial', 15, 'bold')).pack(pady=15)

#Define CheckButtons
values=["C++", "Python", "JavaScript", "Ruby","GoLang"]
for i in values:
   cb= ttk.Checkbutton(win, text=i,state= "disabled")
#Create a Button widget


In the above code snippet, we have disabled all the Checkbuttons Options by disabling its state. To make the Checkbuttons fully functional, we can change the state to state=‘normal’.

Published on 03-May-2021 11:01:03