Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter.ttk import *
- import time
- from ctypes import windll
- windll.shcore.SetProcessDpiAwareness(1)
- def start():
- GB = 10
- download = 0
- speed = 1
- while download < GB:
- time.sleep(0.2)
- print(download/GB)
- download += speed
- bar['value'] = download / GB * 100
- percent.set(f"{int((download/GB)*100)}%")
- text.set(f"{download}/{GB} GB downloaded")
- window.update_idletasks()
- window = Tk()
- percent = StringVar()
- percentLabel = Label(textvariable=percent)
- percentLabel.pack()
- text = StringVar()
- taskLabel = Label(textvariable=text)
- taskLabel.pack()
- bar = Progressbar(window, orient=HORIZONTAL, length=300)
- bar.pack(pady=10)
- button = Button(window, text="download", command=start).pack()
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement