My program needs to display multiple progress bars. When the progress bar fills the entire screen, the remaining progress bars will not be displayed until all progress bars are completed.
from rich.console import Console
from rich.progress import (
Progress,
TextColumn,
BarColumn,
DownloadColumn,
TimeRemainingColumn,
)
import time
from concurrent.futures import ThreadPoolExecutor
console = Console()
def progress_object():
return Progress(
TextColumn(
"[progress.description]{task.description}",
justify="left"),
"•",
BarColumn(
bar_width=20),
"[progress.percentage]{task.percentage:>3.1f}%",
"•",
DownloadColumn(
binary_units=True),
"•",
TimeRemainingColumn(),
console=console,
expand=True
)
def download(progress, i):
task_id = progress.add_task(
f"task {i}", total=10)
for _ in range(10):
time.sleep(0.2)
progress.update(task_id, advance=1)
with progress_object() as progress:
with ThreadPoolExecutor(max_workers=4) as pool:
for i in range(100):
pool.submit(download, progress, i)
Describe the bug
My program needs to display multiple progress bars. When the progress bar fills the entire screen, the remaining progress bars will not be displayed until all progress bars are completed.