Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a progress bar that changes its text on each interation? #121

Closed
sschuberth opened this issue Sep 15, 2023 · 4 comments · Fixed by #151
Closed

How to create a progress bar that changes its text on each interation? #121

sschuberth opened this issue Sep 15, 2023 · 4 comments · Fixed by #151

Comments

@sschuberth
Copy link
Contributor

sschuberth commented Sep 15, 2023

I struggle to create a simple progress bar that shows the progress when iterating over a list of files. I'd like to show the name of the current file, it's index relative to the total count, and the percentage. So something like

first.file 1/50 2% ➡️ second.file 2/50 4% ➡️ ...

Is this possible currently, or does the text() need to remain static?

@ajalt
Copy link
Owner

ajalt commented Sep 15, 2023

It's not currently possible to pass in an object to modify the progress layout like that, but it's a good idea and should be added.

For now, if you aren't using any of the animated columns like progressBar() you can use a textAnimation that you update manually.

You could also clear the animation and create a new one each time the file changes, but that will cause the progress bar to reset too, so that's not ideal.

@CharlyRien
Copy link

Hello, I would like to express my interest in having this feature as well.

In my particular use case, I generate intermediate results from an algorithm over a specific duration. (the duration is from the user's input)
These results are presented as a matching percentage also based on the user’s input. Unfortunately, with the current progress bar, I am unable to display the fluctuating match percentage over time. (Or maybe there is a way that I did not see)

Anyway, I would like to thank you for the work that has been accomplished thus far. It is greatly appreciated. :-)

@ajalt
Copy link
Owner

ajalt commented Jan 14, 2024

@CharlyRien I'm working on this right now on the multi-progress branch. If you're able to build and test it out, I'd love any feedback you have. I gave an example of the new API in #149 (comment), or you can look at the sample.

@CharlyRien
Copy link

Hey @ajalt I'll probably test this out this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants