-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogress_bar_animation.py
62 lines (52 loc) · 1.86 KB
/
progress_bar_animation.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
def generate_progress_bars():
"""
function used for creating the progress bars shown below <progress_bars>
customize the length of <progress_bar> with appending or removing '#'
"""
progress_bar = "##########################"
progress_bars = []
for i in range(len(progress_bar)):
progress_bars.append(progress_bar[0:i] + progress_bar[i:].replace('#', '.'))
progress_bars.append(progress_bar)
return progress_bars
progress_bars = [
"[..........................]",
"[#.........................]",
"[##........................]",
"[###.......................]",
"[####......................]",
"[#####.....................]",
"[######....................]",
"[#######...................]",
"[########..................]",
"[#########.................]",
"[##########................]",
"[###########...............]",
"[############..............]",
"[#############.............]",
"[##############............]",
"[###############...........]",
"[################..........]",
"[#################.........]",
"[##################........]",
"[###################.......]",
"[####################......]",
"[#####################.....]",
"[######################....]",
"[#######################...]",
"[########################..]",
"[#########################.]",
"[##########################]"
]
done = False
def show_progress():
"""
function that loops through the <progress_bars> array until done is set to True
"""
os.system(r'printf "The task is in progress, please wait a few seconds\n" ')
while not done:
for progress_bar in progress_bars:
os.system(r'printf "\r{} Processing..." '.format(progress_bar))
os.system("sleep 0.1")
os.system(r'printf "\rDone"')