Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python Progress Bar
- Credits to Bro Code
- Youtube Channell: https://www.youtube.com/watch?v=0WRMYdOwHYE
- from tkinter import *
- from tkinter.ttk import *
- import time
- def start():
- GB = 100
- download = 0
- speed = 1
- while(download<GB):
- time.sleep(0.05)
- bar['value']+=(speed/GB)*100
- download+=speed
- percent.set(str(int((download/GB)*100))+"%")
- text.set(str(download)+"/"+str(GB)+" GB completed")
- window.update_idletasks()
- window = Tk()
- percent = StringVar()
- text = StringVar()
- bar = Progressbar(window,orient=HORIZONTAL,length=300)
- bar.pack(pady=10)
- percentLabel = Label(window,textvariable=percent).pack()
- taskLabel = Label(window,textvariable=text).pack()
- button = Button(window,text="download",command=start).pack()
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement