rich/examples/status.py

14 lines
307 B
Python
Raw Permalink Normal View History

2020-12-10 17:07:11 +00:00
from time import sleep
from rich.console import Console
console = Console()
console.print()
tasks = [f"task {n}" for n in range(1, 11)]
with console.status("[bold green]Working on tasks...") as status:
while tasks:
task = tasks.pop(0)
2020-12-10 17:25:13 +00:00
sleep(1)
2020-12-10 17:07:11 +00:00
console.log(f"{task} complete")