mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add grid size examples.
This commit is contained in:
10
docs/examples/styles/grid_size_both.css
Normal file
10
docs/examples/styles/grid_size_both.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Grid {
|
||||||
|
grid-size: 2 4; /* (1)! */
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
border: round white;
|
||||||
|
content-align: center middle;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
17
docs/examples/styles/grid_size_both.py
Normal file
17
docs/examples/styles/grid_size_both.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from textual.app import App
|
||||||
|
from textual.containers import Grid
|
||||||
|
from textual.widgets import Label
|
||||||
|
|
||||||
|
|
||||||
|
class MyApp(App):
|
||||||
|
def compose(self):
|
||||||
|
yield Grid(
|
||||||
|
Label("1"),
|
||||||
|
Label("2"),
|
||||||
|
Label("3"),
|
||||||
|
Label("4"),
|
||||||
|
Label("5"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
app = MyApp(css_path="grid_size_both.css")
|
||||||
10
docs/examples/styles/grid_size_columns.css
Normal file
10
docs/examples/styles/grid_size_columns.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Grid {
|
||||||
|
grid-size: 2; /* (1)! */
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
border: round white;
|
||||||
|
content-align: center middle;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
17
docs/examples/styles/grid_size_columns.py
Normal file
17
docs/examples/styles/grid_size_columns.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from textual.app import App
|
||||||
|
from textual.containers import Grid
|
||||||
|
from textual.widgets import Label
|
||||||
|
|
||||||
|
|
||||||
|
class MyApp(App):
|
||||||
|
def compose(self):
|
||||||
|
yield Grid(
|
||||||
|
Label("1"),
|
||||||
|
Label("2"),
|
||||||
|
Label("3"),
|
||||||
|
Label("4"),
|
||||||
|
Label("5"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
app = MyApp(css_path="grid_size_columns.css")
|
||||||
Reference in New Issue
Block a user