from rich import print as pr from rich.panel import Panel from rich.console import RenderGroup from rich.table import Table from rich.live import Live import time from collections import deque import random class Deque(deque): def __rich__(self): return '\n'.join(map(str,self)) def grid(*rows): g = Table.grid(expand=True) for c in rows[0]: g.add_column() for r in rows: g.add_row(*r) return g def quad(d): ps = [Panel(v, title=k) for k,v in d.items()] return RenderGroup( grid(ps[:2], ps[2:]), '# commits: ...' ) types = 'Issues','PRs','Commits','Releases' ds = {o:Deque(maxlen=5) for o in types} for o in range(50): ds[types[random.randint(0,3)]].append(o) pr(quad(ds)) ds = {o:Deque(maxlen=5) for o in types} with Live(refresh_per_second=4) as live: for o in range(40): ds[types[random.randint(0,3)]].append(o) time.sleep(0.1) live.update(quad(ds)) from rich.progress import Progress with Progress() as progress: task1 = progress.add_task("[red]Downloading...", total=20) task2 = progress.add_task("[green]Processing...", total=20) while not progress.finished: progress.update(task1, advance=0.5, refresh=True) progress.update(task2, advance=0.3, refresh=True) time.sleep(0.02)