I want to create a button that I can disable and re-enable as soon as I click it. With the following code, I get a button that I can disable, but it won't re-enable when I click it. If looked at this threat, but it didn't help: Disable / Enable Button in TKinter
import tkinter
from tkinter import *
# toplevel widget of Tk which represents mostly the main window of an application
root = tkinter.Tk()
root.geometry('1800x600')
root.title('Roll Dice')
frame = Frame(root)
# label to display dice
label = tkinter.Label(root, text='', font=('Helvetica', 120))
# function activated by button
def switch1():
if button1["state"] == "active":
button1["state"] = "disabled"
else:
button1["state"] = "active"
button1 = tkinter.Button(root, text='Würfel 1', foreground='green', command=lambda: switch1, state = "active")
button1.pack(side = LEFT)
root.mainloop()
"active"use"normal"command=lambda: switch1usecommand=switch1. Also also you know that when the button is disabled it can't be clicked so the user can't re enable it. What exactly are you trying to do?button1's state. What exactly are you trying to do? Why do you want to toggle the button?