Prompt¶
Class for prompting a user for input. New user options can be added by Prompt.add_option()
,
removed by Prompt.remove_option()
or updated by Prompt.update_option()
.
A message for the user can also be set by the Prompt.set_message()
method.
This class is used in the UIScreen
class. The default
instance always handles r (refresh), c (continue) and q (quit) and is created in the
UIScreen.prompt()
method. To create your own
custom prompt please override
the UIScreen.prompt()
method.
Prompt class¶
-
class
simpleline.render.prompt.
Prompt
(message='Please make a selection from the above')¶ Class to create a prompt message with options.
-
add_continue_option
(description='to continue')¶ Add the option to continue.
-
add_help_option
(description='to help')¶ Add the option to help.
-
add_option
(key, description)¶ Add an option to the prompt. Causes a warning if the option already exists.
Parameters:
-
add_quit_option
(description='to quit')¶ Add the option to quit.
-
add_refresh_option
(description='to refresh')¶ Add the option to refresh.
-
remove_option
(key)¶ Remove an option with the given key.
Parameters: key (str) – the key of the option Returns: the removed option Return type: str|None
-
set_message
(message)¶ Set the prompt message.
Parameters: message (str|None) – the message of the prompt
-