How do I use a progress bar when my script is doing some task that is likely to take time?
For example, a function which takes some time to complete and returns
I really like the python-progressbar, as it is very simple to use.
For the most simple case, it is just:
import progressbar
import time
progress = progressbar.ProgressBar()
for i in progress(range(80)):
time.sleep(0.01)
The appearance can be customized and it can display the estimated remaining time. For an example use the same code as above but with:
progress = progressbar.ProgressBar(widgets=[progressbar.Bar('=', '[', ']'), ' ',
progressbar.Percentage(), ' ',
progressbar.ETA()])