mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add example for grid columns.
This commit is contained in:
11
docs/examples/styles/grid_columns.css
Normal file
11
docs/examples/styles/grid_columns.css
Normal 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%;
|
||||||
|
}
|
||||||
22
docs/examples/styles/grid_columns.py
Normal file
22
docs/examples/styles/grid_columns.py
Normal 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")
|
||||||
Reference in New Issue
Block a user