Replies: 1 comment
-
I think you should use the following code will satisfy your requirements. You can customize the functionality based on the code given below, I suggest you read Progress and Live again, these sections of the documentation will be helpful before you start. hope my answer can solve your problem 😃 import time
from rich.live import Live
from rich.panel import Panel
from rich.progress import (
Progress,
TimeRemainingColumn,
TaskProgressColumn,
TextColumn,
BarColumn,
SpinnerColumn,
)
progress = Progress(
TextColumn("[progress.description]{task.description}"),
SpinnerColumn(),
BarColumn(),
TaskProgressColumn(),
TimeRemainingColumn())
task1 = progress.add_task("[red]Downloading...", total=1000)
task2 = progress.add_task("[green]Processing...", total=1000)
task3 = progress.add_task("[cyan]Cooking...", total=1000)
panel = Panel.fit(progress, title="Title", subtitle="Footer")
with Live(panel, refresh_per_second=4) as live:
while not progress.finished:
progress.update(task1, advance=0.5)
progress.update(task2, advance=0.3)
progress.update(task3, advance=0.9)
time.sleep(0.02) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there, 🙂
I'm trying to draw some progress bars inside of Rich Panels. I'm reading throughout the docs and forums, but the only implementation I see is for Stdout only. Is there a way to do this? This is more or less what I want to do:
Alternatively, I already attempted doing my own progress bars but the issue is that Rich Panels' widths are always
None
unless they're explicitly defined, which isn't always the case, so doing this becomes trickier. Any advice?Thank you for reading!
Cheers,
Posho ✌
Beta Was this translation helpful? Give feedback.
All reactions