mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
styles docs
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
# Styles
|
||||
|
||||
Textual provides a large number of *styles* you can use to customize how your app looks and feels. In this chapter will will look at how you can edit styles in your applications.
|
||||
|
||||
|
||||
## Styles object
|
||||
|
||||
Every widget class in Textual provides a `styles` object which contains a number of writable attributes. Styles define the position and size of a widget, in addition to color, text style, borders, alignment and much more.
|
||||
|
||||
|
||||
|
||||
## Box Model
|
||||
|
||||
|
||||
<div class="excalidraw">
|
||||
--8<-- "docs/images/styles/box.excalidraw.svg"
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
TODO: Styles docs
|
||||
|
||||
- What are styles
|
||||
@@ -10,6 +29,3 @@ TODO: Styles docs
|
||||
- Borders / Outline
|
||||
|
||||
|
||||
<div class="excalidraw">
|
||||
--8<-- "docs/images/styles/box.excalidraw.svg"
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 23 KiB |
@@ -59,7 +59,11 @@ Textual is a framework for building applications that run within your terminal.
|
||||
<hr>
|
||||
|
||||
|
||||
```{.textual path="docs/examples/demo.py" columns=100 lines=48}
|
||||
```{.textual path="examples/calculator.py" columns=100 lines=40}
|
||||
|
||||
```
|
||||
|
||||
```{.textual path="examples/pride.py"}
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import runpy
|
||||
import os
|
||||
import shlex
|
||||
from typing import cast, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -13,7 +14,9 @@ def format_svg(source, language, css_class, options, md, attrs, **kwargs) -> str
|
||||
"""A superfences formatter to insert a SVG screenshot."""
|
||||
|
||||
try:
|
||||
path: str = attrs["path"]
|
||||
cmd: list[str] = shlex.split(attrs["path"])
|
||||
path = cmd[0]
|
||||
|
||||
_press = attrs.get("press", None)
|
||||
press = [*_press.split(",")] if _press else ["_"]
|
||||
title = attrs.get("title")
|
||||
@@ -26,6 +29,8 @@ def format_svg(source, language, css_class, options, md, attrs, **kwargs) -> str
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
app_vars = runpy.run_path(path)
|
||||
if "sys" in app_vars:
|
||||
app_vars["sys"].argv = cmd
|
||||
app: App = cast("App", app_vars["app"])
|
||||
app.run(
|
||||
quit_after=5,
|
||||
|
||||
Reference in New Issue
Block a user