Replies: 2 comments 8 replies
-
Just for clarity: |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
On the more general question, and especially thinking about from textual.app import App, ComposeResult
from textual.containers import Grid
from textual.widgets import Label
DATA =(
("Released", "Title", "Box Office"),
("Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$952,110,690"),
("May 25, 2018", "Solo: A Star Wars Story", "$393,151,347"),
("Dec 15, 2017", "Star Wars Ep. V111: The Last Jedi", "$1,332,539,889"),
("Dec 16, 2016", "Rogue One: A Star Wars Story", "$1,332,439,889"),
)
class FakeTableApp(App[None]):
CSS = """
Grid {
grid-size: 3;
grid-rows: 1;
grid-columns: auto;
grid-gutter: 1;
keyline: thin;
Label {
width: 1fr;
padding: 0 1 0 1;
}
}
"""
def compose(self) -> ComposeResult:
with Grid():
for row in DATA:
for col in row:
yield Label(col)
if __name__ == "__main__":
FakeTableApp().run() |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Uh oh!
There was an error while loading. Please reload this page.
-
Hope you're not tired of my questions yet 😅
I want to replicate the design of the Rich
Table, for example:I don't want to just include a Rich Table as-is, because each cell dynamically updates and recreating the whole table each time would be too expensive. I don't want to use a DataTable because it seems better suited to static data (I also don't need the cursor/colouring, and it's too compact).
I've tried many attempts to style a
Gridto replicate this style, but can't work it out. Outline, Keyline, Border, Rule widgets all have strange behaviour at cell boundaries, or style just the cell (there doesn't seem to be a way to replicate HTML table's<tr>to style entire rows, and it doesn't help for column borders anyway).Is it possible with Textual CSS, or am I thinking about it the wrong way?
Beta Was this translation helpful? Give feedback.
All reactions