rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Allow total to be updated after creation #250

Closed JoeJoeTV closed 1 year ago

JoeJoeTV commented 1 year ago

I have a program, where I'm downloading a file using the requests.urllib.urlretrieve method. Currently, i'm using the report_hook argument to print the percentage using the logging module.

Now I want to integrate alive-progress with this, but the problem is, that the total size only gets passed to the report hook and the with block will of course be outside of the callback function, so I can't set the total at creation.

From the docstrings and README, I haven't found a way to update the total while the progress is running. (I apologize, If this is written there and I didn't see it)

Is this possible using this package or do I just have to use manual mode without a total?

Thanks in advance!

rsalmei commented 1 year ago

No, this is not possible indeed. You could either postpone the creation until you do know the total, or yeah just use manual mode.

There is a future feature that will do something like this, it is called Quantifying Mode. This will allow putting an alive-bar out and then changing/resetting it afterward, including from unknown to definite mode! It is in #59.