File: textual.py

package info (click to toggle)
markdown-exec 1.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 740 kB
  • sloc: python: 2,497; javascript: 180; makefile: 32; sh: 30
file content (27 lines) | stat: -rw-r--r-- 602 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from textual.app import App, ComposeResult
from textual.widgets import Static
from textual._doc import take_svg_screenshot


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


print(take_svg_screenshot(app=TextApp(), terminal_size=(80, 24)))