Skip to main content

Status Bar in Python Tkinter

 






from tkinter import *
from datetime import *
import time

ak = Tk()
ak.geometry("500x400")


def upload():
    sta.set("Loading....")
    s.update()
    time.sleep(2)
    sta.set("Uploaded")
   
   
sta = StringVar()
sta.set("Upload")
s = Label(ak, textvariable=sta,relief=SUNKEN,anchor="w")
s.pack(side=BOTTOM,fill=X)



tie = StringVar()
now = datetime.now()
ti = now.strftime("%H:%M:%S")
tie.set(ti)
Label(s,textvariable=tie,relief=SUNKEN,anchor="e",padx=10).pack(side=RIGHT,padx=10)



Button(ak,text="Set",command=upload,padx=10,pady=10).pack(padx=20,pady=20)

ak.mainloop()


Comments