pymasep.interface.ui_dice_selection

Classes

UIDiceSelection

UI Input that used dices results for value

Module Contents

class pymasep.interface.ui_dice_selection.UIDiceSelection(relative_rect, manager, container, label_text, dices, error_resource)

Bases: pymasep.interface.ui_simple_input.UISimpleInput

UI Input that used dices results for value

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 UIDiceSelection (form pygame_gui)

  • label_text (str) – Text of the label

  • error_resource (pygame.image) – Image displayed when an error occurs

  • dices (str)

dices

dices to launch. See dices.py

dice_pos

position of the dice button

dice_button

button to launch the dices

set_text(text)

set the result of the dices as string

Parameters:

text (str) – result of the dice

get_text()

return the result of the dices as string

Returns:

result of the dices

Return type:

str

process_event(event)

Process event to launch dices if the user presses the button.

Parameters:

event (pygame.event.Event) – Event that could be a UI_BUTTON_PRESSED

Returns:

True if the event has been processed

Return type:

bool

validate()

Validate if the value of the UIInput respects some constraints. In this case, the value of the dice must be between min and max value of the dice expression.

Returns:

True if the value is valid

Return type:

bool