new align

This commit is contained in:
Will McGugan
2022-09-27 16:35:40 +01:00
parent fc4ec8ee50
commit d962dcd49c
80 changed files with 336 additions and 687 deletions

View 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;
}

View 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")

View File

@@ -10,12 +10,6 @@
height: auto;
}
#center-layout {
layout: center;
background: darkslateblue;
height: 7;
}
Static {
margin: 1;
width: 12;

View File

@@ -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")

View File

@@ -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.

View File

@@ -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")

View File

@@ -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")