mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
lots more docs
This commit is contained in:
9
docs/examples/styles/outline.css
Normal file
9
docs/examples/styles/outline.css
Normal file
@@ -0,0 +1,9 @@
|
||||
Screen {
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
Static {
|
||||
margin: 4 8;
|
||||
background: green 20%;
|
||||
outline: wide green;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
19
docs/examples/styles/overflow.css
Normal file
19
docs/examples/styles/overflow.css
Normal 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;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
9
docs/examples/styles/padding.css
Normal file
9
docs/examples/styles/padding.css
Normal file
@@ -0,0 +1,9 @@
|
||||
Screen {
|
||||
background: white;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
Static {
|
||||
padding: 4 8;
|
||||
background: blue 20%;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
15
docs/examples/styles/scrollbar_size.css
Normal file
15
docs/examples/styles/scrollbar_size.css
Normal 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;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
23
docs/examples/styles/scrollbars.css
Normal file
23
docs/examples/styles/scrollbars.css
Normal 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;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
18
docs/examples/styles/text_style.css
Normal file
18
docs/examples/styles/text_style.css
Normal 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;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
7
docs/examples/styles/tint.css
Normal file
7
docs/examples/styles/tint.css
Normal file
@@ -0,0 +1,7 @@
|
||||
Static {
|
||||
height: 3;
|
||||
text-style: bold;
|
||||
background: white;
|
||||
color: black;
|
||||
content-align: center middle;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
12
docs/examples/styles/visibility.css
Normal file
12
docs/examples/styles/visibility.css
Normal file
@@ -0,0 +1,12 @@
|
||||
Screen {
|
||||
background: green;
|
||||
}
|
||||
Static {
|
||||
height: 5;
|
||||
background: white;
|
||||
color: blue;
|
||||
border: heavy blue;
|
||||
}
|
||||
Static.invisible {
|
||||
visibility: hidden;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
5
docs/examples/styles/width.css
Normal file
5
docs/examples/styles/width.css
Normal file
@@ -0,0 +1,5 @@
|
||||
Screen > Widget {
|
||||
background: green;
|
||||
width: 50%;
|
||||
color: white;
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user