question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] - How does one justify center on a live display / live table

See original GitHub issue
import time

from rich.live import Live
from rich.table import Table

table = Table()
table.add_column("Row ID")
table.add_column("Description")
table.add_column("Level")

with Live(table, refresh_per_second=4):  # update 4 times a second to feel fluid
    for row in range(12):
        time.sleep(0.4)  # arbitrary delay
        # update the renderable internally
        table.add_row(f"{row}", f"description {row}", "[red]ERROR")

How would I make this live table displayer in the center? I tried justify = “center” and also passing the console into Live but had no luck

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
Grinchiocommented, Mar 29, 2022

amazing work, thank you so much for the great code.

0reactions
willmcgugancommented, Mar 29, 2022
from rich.progress import Progress
from rich.align import Align
from time import sleep

class CenterProgress(Progress):
    def get_renderable(self):
        return Align.center(super().get_renderable())

progress = CenterProgress()
with progress:
    for n in progress.track(range(100)):
        sleep(0.1)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to center contents of an HTML table ? - GeeksforGeeks
So by using the text-align property for the table element, we can center the contents of the table. The contents of the table...
Read more >
I need to center the <div> in <td> - Stack Overflow
I need to center the <div> in <td> ; You really should not use tables for layouts, there are better solutions. You have...
Read more >
align-content - CSS: Cascading Style Sheets - MDN Web Docs
Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the ...
Read more >
Excel refuses to align a number left or centre - AuditExcel
An interesting client question is where Excel refuses to align a number left or centre. The most likely cause for this is the...
Read more >
Formatting Answer Choices - Qualtrics
Select the question you wish to edit. · On the editing pane to the right, select Edit multiple. · In the text box,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found