docs framework

This commit is contained in:
Will McGugan
2022-05-23 18:02:23 +01:00
parent d1235e0d97
commit 8bdb3dc7e7
7 changed files with 50 additions and 36 deletions

View File

@@ -3,26 +3,9 @@ from textual.widgets import Static
class TextApp(App):
CSS = """
Screen {
background: darkblue;
color: white;
layout: vertical;
}
Static {
height: auto;
padding: 2;
border: heavy white;
background: #ffffff 30%;
content-align: center middle;
/**/
}
"""
def compose(self) -> ComposeResult:
yield Static("Hello")
yield Static("[b]World![/b]")
app = TextApp()
app = TextApp(css_path="simple.css")

View File

@@ -16,10 +16,15 @@ Textual seeks to lower the difficulty level of building a TUI by borrowing devel
--8<-- "docs/examples/simple.py"
```
=== "CSS"
```python
--8<-- "docs/examples/simple.css"
```
=== "Terminal"
```{.textual columns="40" lines="10"}
--8<-- "docs/examples/simple.py"
```{.textual path="docs/examples/simple.py" columns="80" lines="24"}
```
Textual also offers a number of enhancements over traditional TUI applications by taking advantage of improvements to terminal software and the hardware it runs on. Terminals are a far cry from their roots in ancient hardware and dial-up modems, yet much of the software that runs on them hasn't kept pace.