Files
textual/docs/widgets/text_log.md
Will McGugan 2244b1161e api docs (#2240)
* api docs

* more docstrings

* logs

* docs shakeup

* fix notes, added intro to all apis

* Remove defaults to

* add note to events

* note

* use fira code
2023-04-08 15:35:49 +01:00

48 lines
1.5 KiB
Markdown

# TextLog
A TextLog is a widget which displays scrollable content that may be appended to in realtime.
Call [TextLog.write][textual.widgets.TextLog.write] with a string or [Rich Renderable](https://rich.readthedocs.io/en/latest/protocol.html) to write content to the end of the TextLog. Call [TextLog.clear][textual.widgets.TextLog.clear] to clear the content.
- [X] Focusable
- [ ] Container
## Example
The example below shows an application showing a `TextLog` with different kinds of data logged.
=== "Output"
```{.textual path="docs/examples/widgets/text_log.py" press="H,i"}
```
=== "text_log.py"
```python
--8<-- "docs/examples/widgets/text_log.py"
```
## Reactive Attributes
| Name | Type | Default | Description |
| ----------- | ------ | ------- | ------------------------------------------------------------ |
| `highlight` | `bool` | `False` | Automatically highlight content. |
| `markup` | `bool` | `False` | Apply Rich console markup. |
| `max_lines` | `int` | `None` | Maximum number of lines in the log or `None` for no maximum. |
| `min_width` | `int` | 78 | Minimum width of renderables. |
| `wrap` | `bool` | `False` | Enable word wrapping. |
## Messages
This widget sends no messages.
---
::: textual.widgets.TextLog
options:
heading_level: 2