-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
33 lines (25 loc) · 754 Bytes
/
Copy pathexample.py
File metadata and controls
33 lines (25 loc) · 754 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
33
import time
import gress
# init params
sheep = 100
sleep = 0.1
# EXAMPLE 1
print("\nEXAMPLE 1")
for i in gress.gress(range(sheep)):
time.sleep(sleep)
# EXAMPLE 2
print("\nEXAMPLE 2")
# init bar
bar = gress.Bar("Counting: {count} of {maximum} ({percent}%) {bar} {speed}/s | {timer} | ETA {autoeta}", maximum=sheep)
bar.start()
# counting sheep
for i in range(sheep):
time.sleep(sleep)
# increment progress
bar += 1
# count slower while sleeping (50 sheep and more)
if bar.current == sheep / 2:
bar.write("{time} I should sleep now, so I'm counting slower...")
sleep *= 2
# finish and make final report
bar.finish("{time} All {count} sheep counted in {autotimer} with the average rate of {speed}/s")