mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Document Static widget
This commit is contained in:
12
docs/examples/widgets/static.py
Normal file
12
docs/examples/widgets/static.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class StaticApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Static("Hello, world!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = StaticApp()
|
||||
app.run()
|
||||
@@ -1 +1,33 @@
|
||||
# Static
|
||||
|
||||
## Description
|
||||
|
||||
A widget which displays a static renderable content.
|
||||
Can be used for simple text labels, but can also contain more complex Rich renderables.
|
||||
|
||||
## Example
|
||||
|
||||
The example below shows how you can use a `Static` widget as a simple text label.
|
||||
|
||||
=== "Output"
|
||||
|
||||
```{.textual path="docs/examples/widgets/static.py"}
|
||||
```
|
||||
|
||||
=== "static.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/widgets/static.py"
|
||||
```
|
||||
|
||||
## Reactive Attributes
|
||||
|
||||
This widget has no reactive attributes.
|
||||
|
||||
## Messages
|
||||
|
||||
This widget sends no messages.
|
||||
|
||||
## See Also
|
||||
|
||||
* [Static](../reference/static.md) code reference
|
||||
|
||||
@@ -25,13 +25,14 @@ def _check_renderable(renderable: object):
|
||||
|
||||
|
||||
class Static(Widget):
|
||||
"""A widget to display simple static content, or use as a base- lass for more complex widgets.
|
||||
"""A widget to display simple static content, or use as a base class for more complex widgets.
|
||||
|
||||
Args:
|
||||
renderable (RenderableType, optional): A Rich renderable, or string containing console markup.
|
||||
Defaults to "".
|
||||
expand (bool, optional): Rich renderable may expand beyond optimal. Defaults to False.
|
||||
shrink (bool, optional): Rich renderable may shrink below optional. Defaults to False.
|
||||
shrink (bool, optional): Rich renderable may shrink below optimal. Defaults to False.
|
||||
markup (bool, optional): True if markup should be parsed and rendered. Defaults to True.
|
||||
name (str | None, optional): Name of widget. Defaults to None.
|
||||
id (str | None, optional): ID of Widget. Defaults to None.
|
||||
classes (str | None, optional): Space separated list of class names. Defaults to None.
|
||||
|
||||
Reference in New Issue
Block a user