pymasep.interface.ui_choice
Classes
UI Input to choose among a list of choices |
Module Contents
- class pymasep.interface.ui_choice.UIChoice(relative_rect, manager, container, label_text, waited_type, error_resource, choices)
Bases:
pymasep.interface.ui_input.UIInputUI Input to choose among a list of choices
- Parameters:
relative_rect (pygame.Rect) – Position and size of the choice.
manager (pygame_gui.core.interfaces.IUIManagerInterface) – Manager (from pygame_gui).
container (pygame_gui.core.interfaces.IContainerLikeInterface) – Container of the UIChoice (form pygame_gui).
label_text (str) – Text of the label.
waited_type (type) – Expected type of the value chosen.
error_resource (pygame.image) – Image displayed when an error occurs.
choices (List[Tuple[str, str]]) – List of choice (the first element is displayed, the second is the value)
- _font_info
- text_entry_pos
position of the label
- choices
list of choice (1st element is displayed, 2nd is the value)
DropDown menu
- set_text(text)
Set the text to display.
- Parameters:
text (str) – Parameter is not used. First choice at initialization
- get_text()
Get the value of selected element
- Returns:
The second element of the chosen choice (id)
- Return type:
str
- update_options(new_options)
Update the options of the UIChoice. :param new_options: New options to set.
- Returns:
True if a change was made, False otherwise
- Parameters:
new_options (List[Tuple[str, str]])
- Return type:
bool