Add example for grid columns.

This commit is contained in:
Rodrigo Girão Serrão
2022-12-19 17:50:13 +00:00
parent 18a006607c
commit da51877941
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
Grid {
grid-size: 5 2;
grid-columns: 1fr 16 2fr;
}
Label {
border: round white;
content-align-horizontal: center;
width: 100%;
height: 100%;
}

View File

@@ -0,0 +1,22 @@
from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class MyApp(App):
def compose(self):
yield Grid(
Label("1fr"),
Label("width = 16"),
Label("2fr"),
Label("1fr"),
Label("width = 16"),
Label("1fr"),
Label("width = 16"),
Label("2fr"),
Label("1fr"),
Label("width = 16"),
)
app = MyApp(css_path="grid_columns.css")