Timer with Tkinter

mail@pastecode.io avatar
unknown
python
a year ago
664 B
5
Indexable
Never
from tkinter import *
import time




count = 10

#Timer loop:
def loop():
    global count
    for i in range(0, 120):
            count-= 1
            print(count)
            label.config(text=count)
            time.sleep(1)



#Main Window define:
window = Tk()
window.title("App")
window.geometry("800x600")
window.minsize(800, 600)
window.maxsize(800, 600)







#Button label etc..
var = StringVar()
label = Label(window, text="Text modifiable")
label.pack()
entry = Entry(window, textvariable=var)
entry.pack()
button = Button(window, text="Submit", command=loop)
button.pack()









window.mainloop()