implemented a simple menu helper

This commit is contained in:
Luxferre
2025-12-28 09:02:49 +02:00
parent dd002d0369
commit f12d149287
3 changed files with 61 additions and 0 deletions
+6
View File
@@ -54,6 +54,12 @@ Exported functions:
- `reflow(text)`: split text into a list of lines not exceeding terminal width
- `print_paged(text)`: reflow and print the text in a paginated manner, prompting for Enter presses to move to the next page
### `deck.menu`
A library for easy menu systems for T-DeckARD programs. Allows displaying up to 10 menu items with the ability to select them with a single digit or a key on the `QWERTYUIOP` keyboard row.
Exports the only function, `menu(choices)`, which accepts a list of **tuples**, each in the format `(id, label)`. The `label` field is what's displayed on the screen, the `id` field is the string that gets returned upon selection. If the user selects `c`, the operation is canceled and an empty `id` string is returned.
### `deck.time`
A wrapper for standard Python `date`, `time` and `datetime` modules. Just run `from deck.time import *` to activate.