when button is clicked tkinter python
def someFunction:
function body
tkWindow = Tk()
button = Button(tkWindow, command=someFunction)
when button is clicked tkinter python
def someFunction:
function body
tkWindow = Tk()
button = Button(tkWindow, command=someFunction)
tkinter while button not pressed
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()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us