-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogressbar.py
More file actions
32 lines (25 loc) · 765 Bytes
/
progressbar.py
File metadata and controls
32 lines (25 loc) · 765 Bytes
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
from tkinter import *
from tkinter.ttk import *
import time
def start():
GB = 10
speed = 1
download = 0
bar['value']=0
while(download<GB):
time.sleep(0.05)
bar['value'] += (speed/GB)*100
download += speed
text.set(str(download) + '/' + str(GB) + ' GB completed')
percent.set(str(int((download/GB)*100)) + '% completed')
window.update_idletasks()
window = Tk()
window.title('A progressbar case')
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(window,text='Download',command=start).pack()
window.mainloop()