-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprogress_bar.py
More file actions
48 lines (38 loc) · 1.22 KB
/
progress_bar.py
File metadata and controls
48 lines (38 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from tkinter import *
from tkinter.ttk import *
import time
# Functions
def start():
GB = 343
for i in range(1, 101):
if i == 100:
download.set("Downloading Completed.")
percent.set("100% Downloaded")
progress.set("")
download.set("Downloading Call Of Duty: Warzone IV")
bar["value"] += 1
time.sleep(0.05)
percent.set(f"{i}% Downloaded")
progress.set(f"{int((GB/100)*i)}GBs Downloaded out of {GB}GBs.")
window.update_idletasks()
# Creating Window
window = Tk()
# Styling Window
window.title("Progress Bar Program Tkinter")
window.geometry("450x200")
# Creating Download Variable
download = StringVar()
Label(window, textvariable=download, font=("Arial", 15)).pack()
# Creating the Progress Bar
bar = Progressbar(window, orient=HORIZONTAL, length=350)
bar.pack(pady=10)
# Representing Progress Bar in Text
progress = StringVar()
Label(window, textvariable=progress).pack()
# Creating Percent Variable
percent = StringVar()
perLbl = Label(window, textvariable=percent).pack()
# Creating Download Button
Button(window, text="Download", command=start).pack()
# Displaying Window
window.mainloop()