Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
49.68k stars 1.73k forks source link

[BUG]When there are too many progress bars, all progress bars cannot be displayed #3207

Open JoeanAmier opened 1 year ago

JoeanAmier commented 1 year ago

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.

1700288051394

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)
github-actions[bot] commented 1 year ago

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

JoeanAmier commented 1 year ago

I can only remove the completed progress bars now to avoid having too many progress bars.