mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
new align
This commit is contained in:
13
docs/examples/styles/align.css
Normal file
13
docs/examples/styles/align.css
Normal file
@@ -0,0 +1,13 @@
|
||||
Screen {
|
||||
align: center middle;
|
||||
}
|
||||
|
||||
.box {
|
||||
width: 40;
|
||||
height: 5;
|
||||
margin: 1;
|
||||
padding: 1;
|
||||
background: green;
|
||||
color: white 90%;
|
||||
border: heavy white;
|
||||
}
|
||||
11
docs/examples/styles/align.py
Normal file
11
docs/examples/styles/align.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from textual.app import App
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class AlignApp(App):
|
||||
def compose(self):
|
||||
yield Static("Vertical alignment with [b]Textual[/]", classes="box")
|
||||
yield Static("Take note, browsers.", classes="box")
|
||||
|
||||
|
||||
app = AlignApp(css_path="align.css")
|
||||
@@ -10,12 +10,6 @@
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#center-layout {
|
||||
layout: center;
|
||||
background: darkslateblue;
|
||||
height: 7;
|
||||
}
|
||||
|
||||
Static {
|
||||
margin: 1;
|
||||
width: 12;
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
from textual import layout
|
||||
from textual.app import App
|
||||
from textual.widget import Widget
|
||||
from textual.containers import Container
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class LayoutApp(App):
|
||||
def compose(self):
|
||||
yield layout.Container(
|
||||
yield Container(
|
||||
Static("Layout"),
|
||||
Static("Is"),
|
||||
Static("Vertical"),
|
||||
id="vertical-layout",
|
||||
)
|
||||
yield layout.Container(
|
||||
yield Container(
|
||||
Static("Layout"),
|
||||
Static("Is"),
|
||||
Static("Horizontal"),
|
||||
id="horizontal-layout",
|
||||
)
|
||||
yield layout.Container(
|
||||
Static("Center"),
|
||||
id="center-layout",
|
||||
)
|
||||
|
||||
|
||||
app = LayoutApp(css_path="layout.css")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from textual.app import App
|
||||
from textual.widgets import Static
|
||||
from textual.layout import Horizontal, Vertical
|
||||
from textual.containers import Horizontal, Vertical
|
||||
|
||||
TEXT = """I must not fear.
|
||||
Fear is the mind-killer.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from textual.app import App
|
||||
from textual import layout
|
||||
from textual.containers import Vertical
|
||||
from textual.widgets import Static
|
||||
|
||||
TEXT = """I must not fear.
|
||||
@@ -14,7 +14,7 @@ Where the fear has gone there will be nothing. Only I will remain.
|
||||
|
||||
class ScrollbarApp(App):
|
||||
def compose(self):
|
||||
yield layout.Vertical(Static(TEXT * 5), classes="panel")
|
||||
yield Vertical(Static(TEXT * 5), classes="panel")
|
||||
|
||||
|
||||
app = ScrollbarApp(css_path="scrollbar_size.css")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from textual.app import App
|
||||
from textual import layout
|
||||
from textual.containers import Vertical
|
||||
from textual.widgets import Static
|
||||
|
||||
TEXT = """I must not fear.
|
||||
@@ -14,8 +14,8 @@ Where the fear has gone there will be nothing. Only I will remain.
|
||||
|
||||
class ScrollbarApp(App):
|
||||
def compose(self):
|
||||
yield layout.Vertical(Static(TEXT * 5), classes="panel1")
|
||||
yield layout.Vertical(Static(TEXT * 5), classes="panel2")
|
||||
yield Vertical(Static(TEXT * 5), classes="panel1")
|
||||
yield Vertical(Static(TEXT * 5), classes="panel2")
|
||||
|
||||
|
||||
app = ScrollbarApp(css_path="scrollbars.css")
|
||||
|
||||
Reference in New Issue
Block a user