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

Investigate Rich Progress Bars #138

Open
mdancho84 opened this issue Oct 19, 2023 · 0 comments
Open

Investigate Rich Progress Bars #138

mdancho84 opened this issue Oct 19, 2023 · 0 comments

Comments

@mdancho84
Copy link
Contributor

Investigate Rich Progress Bars

from rich.progress import Progress, BarColumn, TextColumn, TimeElapsedColumn
from rich.console import Console
from rich.style import Style
from time import sleep

console = Console()

# Define custom styles
custom_bar_style = Style(color="#2c3e50")  # Color of the progress bar
custom_completed_style = Style(color="#18BC9C")  # Color of the completed section
custom_text_style = Style(color="#2c3e50")  # Color of the text

# Define custom progress bar
progress = Progress(
    TextColumn("[progress.description]{task.description}", style=custom_text_style),
    BarColumn(bar_width=None, style=custom_bar_style, complete_style=custom_completed_style),
    "[progress.percentage]{task.percentage:>3.0f}%",
    TimeElapsedColumn(),
)

# Add a task to the progress bar
with progress:
    task_id = progress.add_task("[#2c3e50]PyTimeTK, Engine=Polars...", total=100)

    # Update the task
    while not progress.finished:
        progress.update(task_id, advance=0.5)
        sleep(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant