pybot.minitel.menu
¶
-
class
pybot.minitel.menu.
Menu
(mt, title, choices, prompt=None, line_skip=0, margin_top=0, prompt_line=None, addit=None)[source]¶ Bases:
object
Displays a menu with choices and handles the user input.
The input is checked against the list of selectable options, the menu staying displayed until a valid one is entered.
Canceling is possible by using the SOMMAIRE (content) key.
Parameters: - mt (
Minitel
) – the Minitel instance - title (str or list of str) – the menu title, displayed centered on the screen
- choices (list of str) – the options
- prompt (str) – the prompt displayed with the input field. Default: “Your choice”
- line_skip (int) – vertical space between options. Default (0) places options on consecutive lines
- margin_top (int) – vertical space before the menu title. Default: 0
- prompt_line (int) – line number on which the input prompt is displayed
- addit (list of tuple) – additional prompts as a list of (x, y, text) tuples
-
get_choice
(max_wait=None)[source]¶ Waits for the user input and returns it.
The entered value is checked against the number of options, and rejected if not valid. Input can be cancelled by using the SOMMAIRE key.
Parameters: max_wait (int) – maximum wait time in seconds for selecting an option (if None, waits indefinitely) Returns: the option number (starting from 1) or None if input has been canceled
- mt (