- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 change Tkinter Button state from disabled to normal?
Tkinter provides Button widgets to create a button for triggering an event. Let us suppose we have created a button that is already disabled in an application. In order to change the state of the button, we can use the state property.
The state property is used to enable and disable a button in an application. In order to change the state of the application, we have two operations: state=DISABLED and state=NORMAL.
#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("650x450") #Define a function for Button Object def quit_win(): win.destroy() #Create a button to quit the window Button(win,text="Quit", command=quit_win, font=('Helvetica bold',20), state= NORMAL).pack(pady=5) win.mainloop()
The output when the button is disabled,
Output when Button state=NORMAL
- How to change Tkinter label text on button press?
- How to change the color of ttk button in Tkinter?
- How to exit from Python using a Tkinter Button?
- How do I change button size in Python Tkinter?
- How to make a Button Hover to change the Background Color in Tkinter?
- Set disabled state for Bootstrap Buttons
- Change command Method for Tkinter Button in Python
- HTML DOM Button disabled Property
- How to change the TKinter canvas line from dash to solid?
- Change the color upon hovering over Button in Tkinter
- How to create a Tkinter toggle button?
- How to Change Tkinter Frame Title?
- HTML DOM Input Button disabled Property
- How To Dynamically Resize Button Text in Tkinter?