textual/docs/widgets/digits.md
2024-10-05 17:37:12 +01:00

70 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Digits
!!! tip "Added in version 0.33.0"
A widget to display numerical values in tall multi-line characters.
The digits 0-9 and characters A-F are supported, in addition to `+`, `-`, `^`, `:`, and `×`.
Other characters will be displayed in a regular size font.
You can set the text to be displayed in the constructor, or call [`update()`][textual.widgets.Digits.update] to change the text after the widget has been mounted.
!!! note "This widget will respect the [text-align](../styles/text_align.md) rule."
- [ ] Focusable
- [ ] Container
## Example
The following example displays a few digits of Pi:
=== "Output"
```{.textual path="docs/examples/widgets/digits.py"}
```
=== "digits.py"
```python
--8<-- "docs/examples/widgets/digits.py"
```
Here's another example which uses `Digits` to display the current time:
=== "Output"
```{.textual path="docs/examples/widgets/clock.py"}
```
=== "clock.py"
```python
--8<-- "docs/examples/widgets/clock.py"
```
## Reactive Attributes
This widget has no reactive attributes.
## Messages
This widget posts no messages.
## Bindings
This widget has no bindings.
## Component Classes
This widget has no component classes.
---
::: textual.widgets.Digits
options:
heading_level: 2