- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to disable a Combobox in Tkinter?
The Combobox widget is similar to the OptionMenu widget in Tkinter which gives the user a choice to select from the group of options. The Combobox widget allows users to select the option with an Entry widget that adds selected menu items from the dropdown list.
We can Enable or Disable the options in the given Combobox widget by providing the state property. The state property forces to make a widget either active or disabled. To disable the Combobox widget, we have to set the state property as readonly or disabled.
Example
#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 win.geometry("750x250") #Define a Label widget Label(win, text= "Select an Option from the List", font=('Aerial', 14, 'bold')).pack(pady=15) #Create a Combobox with list of items var= StringVar() my_combobox= ttk.Combobox(win, textvariable=var, values=["High", "Mid","Low"], state= 'disabled') my_combobox.pack() #Create a Button widget win.mainloop()
In the above code snippet, we have disabled the Combobox widget by disabling the state. Now, to make the widget fully functional, just change the state of the widget using state= ‘normal’.
Output
- Related Articles
- Combobox Widget in Python Tkinter
- How to Disable / Enable a Button in TKinter?
- How to get the index of selected option in Tkinter Combobox?
- Set a default value for a ttk Combobox in Tkinter?
- How to disable (grey out) a checkbutton in Tkinter?
- How to gray out (disable) a Tkinter Frame?
- How to disable multiselection on Treeview in tkinter?
- How to disable an Entry widget in Tkinter?
- How to disable checkbutton Tkinter (grey out)?
- How can I disable typing in a ttk.Combobox tkinter?
- How to edit a comboBox in JavaFX?
- How to hide or disable the mouse pointer in Tkinter?
- How to create a ComboBox using JavaFX?
- Disable Exit (or [ X ]) in Tkinter Window
- How to right align the text in a ComboBox in Java

Advertisements