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

[REQUEST] render_string method for rich.progress's Progress() #3017

Closed
pcroland opened this issue Jul 2, 2023 · 2 comments
Closed

[REQUEST] render_string method for rich.progress's Progress() #3017

pcroland opened this issue Jul 2, 2023 · 2 comments

Comments

@pcroland
Copy link

pcroland commented Jul 2, 2023

from rich.progress import BarColumn, Progress, TaskID, TimeRemainingColumn
import time

regions=240

pb = Progress(BarColumn(bar_width=10),  '{task.description}', '[magenta]{task.percentage:>3.2f}%', TimeRemainingColumn(), refresh_per_second=3)

t = pb.add_task('', total=regions)

with pb:
    for i in range(regions):
        pb.update(task_id=t, advance=1, description=f"{i}/{regions}")
        bar_str = pb.render_string()
        tg_edit_message(bar_str)
        time.sleep(0.03)

I want to save the current progress bar look without formatting codes to a string so i can use it in Telegram messages.
So bar_str should be this: "━━╺━━━━━━━ 53/240 22.50% 0:00:07"

Or is there any way that lets me do this?

@github-actions
Copy link

github-actions bot commented Jul 2, 2023

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@pcroland pcroland closed this as completed Jul 9, 2023
@github-actions
Copy link

github-actions bot commented Jul 9, 2023

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

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

No branches or pull requests

1 participant