Created
August 13, 2021 15:37
-
-
Save brando90/3304119120841b1ebf892fe93a2cc3c9 to your computer and use it in GitHub Desktop.
having_the_progress_bar_show_its_done_properly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Use this one to make sure the "end" is shown properly 100% etc | |
""" | |
import time | |
import progressbar | |
widgets = [ | |
progressbar.Percentage(), | |
progressbar.Bar(), | |
' ', progressbar.SimpleProgress(), | |
' ', progressbar.ETA(), | |
' ', progressbar.AdaptiveTransferSpeed(unit='it'), | |
] | |
bar = progressbar.ProgressBar(widgets=widgets) | |
for i in bar(range(100)): | |
time.sleep(0.1) | |
bar.update(i) | |
""" | |
19%|########## | 19 of 100 ETA: 0:00:17 4.9 it/s | |
when done: | |
100%|####################################| 100 of 100 Time: 0:00:20 4.9 it/s | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the key is to wrap the iterator (of fixed length) using bar e.g.
bar(range(100))