Untitled

 avatar
Majeric
plain_text
2 years ago
589 B
4
Indexable
Never
from tkinter import *
import threading
from time import sleep

#Define the tkinter instance
win= Tk()
win.geometry("700x400")

#Define the function to start the thread

def count_down():
	#manipulate files

    for x in range(1, 10):
        var.set("time:" + str(x))
        sleep(1)
    var.set("Done!")
	

def some_work():
	threading.Thread(target=count_down).start()

var = StringVar()
var.set("Idle")
label= Label(win, textvariable= var)
label.pack(pady=20)
#Create button
b1= Button(win,text= "Start", command=some_work)
b1.pack(pady=20)

win.mainloop()