Advertisement
Guest User

Untitled

a guest
Nov 9th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. from tkinter import *
  2. from tkinter.ttk import *
  3. import time
  4. from ctypes import windll
  5. windll.shcore.SetProcessDpiAwareness(1)
  6.  
  7. def start():
  8. GB = 10
  9. download = 0
  10. speed = 1
  11. while download < GB:
  12. time.sleep(0.2)
  13. print(download/GB)
  14. download += speed
  15. bar['value'] = download / GB * 100
  16. percent.set(f"{int((download/GB)*100)}%")
  17. text.set(f"{download}/{GB} GB downloaded")
  18. window.update_idletasks()
  19.  
  20. window = Tk()
  21.  
  22. percent = StringVar()
  23.  
  24. percentLabel = Label(textvariable=percent)
  25. percentLabel.pack()
  26.  
  27. text = StringVar()
  28.  
  29. taskLabel = Label(textvariable=text)
  30. taskLabel.pack()
  31.  
  32. bar = Progressbar(window, orient=HORIZONTAL, length=300)
  33. bar.pack(pady=10)
  34.  
  35. button = Button(window, text="download", command=start).pack()
  36.  
  37. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement