mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docs framework
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user