lots more docs

This commit is contained in:
Will McGugan
2022-08-14 15:43:00 +01:00
parent a1c0b173bd
commit 538e5d4701
45 changed files with 653 additions and 199 deletions

View File

@@ -0,0 +1,9 @@
Screen {
background: white;
color: black;
}
Static {
margin: 4 8;
background: green 20%;
outline: wide green;
}

View File

@@ -12,20 +12,8 @@ Where the fear has gone there will be nothing. Only I will remain."""
class OutlineApp(App):
CSS = """
Screen {
background: white;
color: black;
}
Static {
margin: 4 8;
background: green 20%;
outline: wide green;
}
"""
def compose(self):
yield Static(TEXT)
app = OutlineApp()
app = OutlineApp(css_path="outline.css")

View File

@@ -0,0 +1,19 @@
Screen {
background: $background;
color: black;
}
Vertical {
width: 1fr;
}
Static {
margin: 1 2;
background: blue 20%;
border: blue wide;
height: auto;
}
#right {
overflow-y: hidden;
}

View File

@@ -12,28 +12,6 @@ Where the fear has gone there will be nothing. Only I will remain."""
class OverflowApp(App):
CSS = """
Screen {
background: $background;
color: black;
}
Vertical {
width: 1fr;
}
Static {
margin: 1 2;
background: blue 20%;
border: blue wide;
height: auto;
}
#right {
overflow-y: hidden;
}
"""
def compose(self):
yield Horizontal(
Vertical(Static(TEXT), Static(TEXT), Static(TEXT), id="left"),
@@ -41,4 +19,4 @@ class OverflowApp(App):
)
app = OverflowApp()
app = OverflowApp(css_path="overflow.css")

View File

@@ -0,0 +1,9 @@
Screen {
background: white;
color: blue;
}
Static {
padding: 4 8;
background: blue 20%;
}

View File

@@ -11,22 +11,8 @@ Where the fear has gone there will be nothing. Only I will remain."""
class PaddingApp(App):
CSS = """
Screen {
background: white;
color: blue;
}
Static {
padding: 4 8;
background: blue 20%;
}
"""
def compose(self):
yield Static(TEXT)
app = PaddingApp()
app = PaddingApp(css_path="padding.css")

View File

@@ -0,0 +1,15 @@
Screen {
background: white;
color: blue 80%;
layout: horizontal;
}
Static {
padding: 1 2;
width: 200;
}
.panel {
scrollbar-size: 10 4;
padding: 1 2;
}

View File

@@ -13,26 +13,8 @@ Where the fear has gone there will be nothing. Only I will remain.
class ScrollbarApp(App):
CSS = """
Screen {
background: white;
color: blue 80%;
layout: horizontal;
}
Static {
padding: 1 2;
width: 200;
}
.panel {
scrollbar-size: 10 4;
padding: 1 2;
}
"""
def compose(self):
yield layout.Vertical(Static(TEXT * 5), classes="panel")
app = ScrollbarApp()
app = ScrollbarApp(css_path="scrollbar_size.css")

View File

@@ -0,0 +1,23 @@
Screen {
background: #212121;
color: white 80%;
layout: horizontal;
}
Static {
padding: 1 2;
}
.panel1 {
width: 1fr;
scrollbar-color: green;
scrollbar-background: #bbb;
padding: 1 2;
}
.panel2 {
width: 1fr;
scrollbar-color: yellow;
scrollbar-background: purple;
padding: 1 2;
}

View File

@@ -13,37 +13,9 @@ Where the fear has gone there will be nothing. Only I will remain.
class ScrollbarApp(App):
CSS = """
Screen {
background: #212121;
color: white 80%;
layout: horizontal;
}
Static {
padding: 1 2;
}
.panel1 {
width: 1fr;
scrollbar-color: green;
scrollbar-background: #bbb;
padding: 1 2;
}
.panel2 {
width: 1fr;
scrollbar-color: yellow;
scrollbar-background: purple;
padding: 1 2;
}
"""
def compose(self):
yield layout.Vertical(Static(TEXT * 5), classes="panel1")
yield layout.Vertical(Static(TEXT * 5), classes="panel2")
app = ScrollbarApp()
app = ScrollbarApp(css_path="scrollbars.css")

View File

@@ -0,0 +1,18 @@
Screen {
layout: horizontal;
}
Static {
width:1fr;
}
#static1 {
background: red 30%;
text-style: bold;
}
#static2 {
background: green 30%;
text-style: italic;
}
#static3 {
background: blue 30%;
text-style: reverse;
}

View File

@@ -11,31 +11,10 @@ Where the fear has gone there will be nothing. Only I will remain."""
class TextStyleApp(App):
CSS = """
Screen {
layout: horizontal;
}
Static {
width:1fr;
}
#static1 {
background: red 30%;
text-style: bold;
}
#static2 {
background: green 30%;
text-style: italic;
}
#static3 {
background: blue 30%;
text-style: reverse;
}
"""
def compose(self):
yield Static(TEXT, id="static1")
yield Static(TEXT, id="static2")
yield Static(TEXT, id="static3")
app = TextStyleApp()
app = TextStyleApp(css_path="text_style.css")

View File

@@ -0,0 +1,7 @@
Static {
height: 3;
text-style: bold;
background: white;
color: black;
content-align: center middle;
}

View File

@@ -4,16 +4,6 @@ from textual.widgets import Static
class TintApp(App):
CSS = """
Static {
height: 3;
text-style: bold;
background: white;
color: black;
content-align: center middle;
}
"""
def compose(self):
color = Color.parse("green")
for tint_alpha in range(0, 101, 10):
@@ -22,4 +12,4 @@ class TintApp(App):
yield widget
app = TintApp()
app = TintApp(css_path="tint.css")

View File

@@ -0,0 +1,12 @@
Screen {
background: green;
}
Static {
height: 5;
background: white;
color: blue;
border: heavy blue;
}
Static.invisible {
visibility: hidden;
}

View File

@@ -3,25 +3,10 @@ from textual.widgets import Static
class VisibilityApp(App):
CSS = """
Screen {
background: green;
}
Static {
height: 5;
background: white;
color: blue;
border: heavy blue;
}
Static.invisible {
visibility: hidden;
}
"""
def compose(self):
yield Static("Widget 1")
yield Static("Widget 2", classes="invisible")
yield Static("Widget 3")
app = VisibilityApp()
app = VisibilityApp(css_path="visibility.css")

View File

@@ -0,0 +1,5 @@
Screen > Widget {
background: green;
width: 50%;
color: white;
}

View File

@@ -3,16 +3,8 @@ from textual.widget import Widget
class WidthApp(App):
CSS = """
Screen > Widget {
background: green;
width: 50%;
color: white;
}
"""
def compose(self):
yield Widget()
app = WidthApp()
app = WidthApp(css_path="width.css")