Answers for "python tkinter get button state"

5

make tkinter btn disable

btn1['state'] = 'normal'
btn1['state'] = 'disabled'
Posted by: Guest on November-11-2020
0

button state change in tknter

from tkinter import *
fenster = Tk()
fenster.title("Window")

def switch():
    if(b1['state']==NORMAL):
        b1["state"] = DISABLED
        b2["text"]="enable"
    elif (b1['state']==DISABLED):
        b1["state"]=NORMAL
        b2["text"]="disable"

#--Buttons
b1=Button(fenster, text="Button")
b1.config(height = 5, width = 7)
b1.grid(row=0, column=0)    
b2 = Button(text="disable", command=switch)
b2.grid(row=0,column=1)
fenster.mainloop()
Posted by: Guest on October-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language