Replies: 1 comment 3 replies
-
Here is some code that could help: The idea is:
... Updated on 2025-03-16 thanks to 2 comments from @mcourteaux import time
from rich.progress import Progress
from rich.console import Console, Group
from rich.live import Live
from rich.panel import Panel
console = Console()
# outer status bar and progress bar
status = console.status("Not started")
progress = Progress(transient=True)
with Live(Panel(Group(status, progress)), console=console): # Optionally: you can remove the `Panel(...)` so just `Live(Group(...))`
for status_name in ('status1', 'status2', 'status3'):
status.update(f"[bold green]Status = {status_name}")
task_id = progress.add_task(f"Working on task for {status_name}")
for i in progress.track(range(25), task_id=task_id):
time.sleep(0.1)
progress.remove_task(task_id)
status.update("[bold green]Status = Done") This looks like this during the run ... and if you want the status bar below (which would look nicer), just do: ...
with Live(Panel(Group(progress, status))):
... |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to come up with a good solution for displaying a progressbar for each status in a list.
For a concrete example.
However, this solution seems to not render very cleanly as when the progressbar updates, the status plot will disappear and reappear. Is there a better solution for this kind of problem? Perhaps I need to split the status and progressbar as a table view?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions