[REQUEST] How can i show two tables simultaneously ? #1156
-
from time import sleep
from rich.live import Live
from rich.table import Table
from rich.panel import Panel
from rich.progress import Progress
def func():
with Live(refresh_per_second=10) as live:
t1 = Table().grid()
job_progress1 = Progress()
job_progress1.add_task("[green]Task 1")
t1.add_row(Panel.fit(job_progress1, border_style="green", padding=(2, 2)))
t2 = Table().grid()
job_progress2 = Progress()
job_progress2.add_task("[green]Task 2")
t2.add_row(Panel.fit(job_progress2, border_style="green", padding=(2, 2)))
for i in range(100):
job_progress1.update(0, advance=1)
job_progress2.update(0, advance=1)
sleep(0.1)
live.update(t1)
live.update(t2)
if __name__ == '__main__':
func() |
Beta Was this translation helpful? Give feedback.
Answered by
willmcgugan
Apr 2, 2021
Replies: 1 comment 1 reply
-
Put the tables in a table. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
willmcgugan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put the tables in a table.