| |
- for_bool(prompt_text, default=None, error_message='Please enter a bool value: True or False')
- Prompt for a bool; use the specified prompt_text (with default in brackets
appended if it is non-None) followed by ': '; verify that the entered value (using
default if the user just presses enter) is True or False (and if not display the
error_message)
See the call to for_value below, and the documentation and code for for_value above.
- for_char(prompt_text, default=None, legal=None, error_message='Please enter one char in the range (if specified)')
- for_float(prompt_text, default=None, is_legal=<function <lambda>>, error_message='not a legal value')
- Prompt for a float; use the specified prompt_text (with default in brackets
appended if it is non-None) followed by ': '; verify that the entered value
(using default if the user just presses enter) is a float and is_legal
returns True when called on it (and if not display the error_message)
See the call to for_value below, and the documentation and code for for_value above.
- for_int(prompt_text, default=None, is_legal=<function <lambda>>, error_message='not a legal value')
- Prompt for an int; use the specified prompt_text (with default in brackets
appended if it is non-None) followed by ': '; verify that the entered value
(using default if the user just presses enter) is an int and is_legal
returns True when called on it (and if not display the error_message)
See the call to for_value below, and the documentation and code for for_value above.
- for_int_between(prompt_text, low, high, default=None, error_message='')
- for_num(prompt_text, default=None, is_legal=<function <lambda>>, error_message='not a legal value')
- Prompt for an int or float; use the specified prompt_text (with default in brackets
appended if it is non-None) followed by ': '; verify that the entered value
(using default if the user just presses enter) is an int or float and is_legal
returns True when called on it (and if not display the error_message)
See the call to for_value below, and the documentation and code for for_value above.
- for_string(prompt_text, default=None, is_legal=<function <lambda>>, error_message='')
- Prompt for a string; use the specified prompt_text (with default in brackets
appended if it is non-None) followed by ': '; verify that the entered value
(using default if the user just presses enter) returns True when is_legal is
called on it (and if not display the error_message)
See the call to for_value below, and the documentation and code for for_value above.
- for_string_via_index(prompt_text, default=None, legal=None, error_message='Please enter a legal integer index')
- Prompt for an int index but return its associated string; use the specified prompt_text
(with each string in the list legal prefaced by its index in brackets, and with default
in brackets appended if it is non-None) followed by ': '; verify that the entered value
is the index of some string (or just return the default if the user just presses enter)
(and if not display theerror_message)
See the call to for_value below, and the documentation and code for for_value above.
- for_value(prompt_text, convert=<function <lambda>>, is_legal=<function <lambda>>, default=None, error_message='reenter')
- Prompt for value using the specified prompt_text (with default in brackets
appended if it is non-None) followed by ': '; convert the entered value
(or use the default if the user just presses enter), ensure is_legal
returns True when called on it, and return that value.
Display error_messages for all possible failures
See the comments in the code for more details
See the calls to for_value below, for examples of how it is called.
|