-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathunit_progress.py
More file actions
25 lines (17 loc) · 671 Bytes
/
Copy pathunit_progress.py
File metadata and controls
25 lines (17 loc) · 671 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
"""``UnitProgress`` shows a count against its total with a unit label.
Reach for it when the count needs a unit -- "12 of 24 files" -- with
optional 1024-based scaling for large counts. Compare ``SimpleProgress``
for the same idea without a unit, and ``DataSize`` for a single scaled
byte value rather than a count against a total.
"""
import time
import progressbar
STEPS = 24
def main() -> None:
widgets = [progressbar.UnitProgress(unit='files')]
with progressbar.ProgressBar(max_value=STEPS, widgets=widgets) as bar:
for step in range(STEPS):
bar.update(step + 1)
time.sleep(0.005)
if __name__ == '__main__':
main()