Tkinter während der Taste nicht gedrückt
from tkinter import *
root = Tk()
root.geometry('250x250')
display = Label(root, text='Hello', font=('', 20))
display.pack(pady=40)
def restart():
display['text'] = 'Restarting...'
but['state'] = 'disable' # Once restarted the button gets disabled
def cancel():
# Cancel the current after with it id
root.after_cancel(L)
display['text'] = 'Cancelled'
# Take a reference of after
L = root.after(5000, restart)
but = Button(root, text='Cancel', command = cancel )
but.pack(side='bottom', pady=30)
mainloop()
Poor Pigeon