Q:

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()
0

New to Communities?

Join the community