I'm trying to make a button like a switch, so if I click the disable button it will disable the "Button" (that works). And if I press it again, it will enable it again.
I tried things like if, else but didn't get it to work. Here's an example:
from tkinter import *
fenster = Tk()
fenster.title("Window")
def switch():
b1["state"] = DISABLED
#--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()