Skip to content

Change progress bar text when completing 100% #2353

Discussion options

You must be logged in to vote

This would be the expected behaviour. When you advance to 100%, you sleep a total of 2 seconds before setting the description. If you want to change the description text, you should do it as soon as the task is finished.

Try this:

from rich.progress import Progress
import time
import sys

def main(timeout):
    start_time = time.time()

    penultimate_quarter = timeout-1
    with Progress() as progress:
        task1 = progress.add_task("[green]Processing...", total=100)
        time.sleep(1)
        while not progress.finished:
            time.sleep(1)
            progress.update(task1, advance=100/penultimate_quarter)
        progress.update(task1, description="[blue]Complete Task", a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fredericomattos
Comment options

Answer selected by fredericomattos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants