Guest User

Untitled

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