UI Manager

class UI[source]

Bases: object

Manage the UI, such as windows, resource bars etc

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

create_screen_message(message: str, colour: str = '#531B75', size: int = 4)[source]

Create a message on the screen.

draw()[source]

Draw the UI.

element_is_active(element_type: scripts.engine.internal.constant.UIElement)bool[source]

Check if an element has been created and is visible

element_is_visible(element_type: scripts.engine.internal.constant.UIElement)bool[source]

Check if an element is visible.

get_element(element_type: UIElement)Union[Panel, Window][source]

Get UI element.

get_gui_manager()pygame_gui.ui_manager.UIManager[source]

Return the pygame_gui UI Manager

has_element(element_type: scripts.engine.internal.constant.UIElement)bool[source]

Check if an element exists

kill_all_elements()[source]

Close and kill the game’s UI elements. Helper function to run kill_element on all elements.

kill_element(element_type: scripts.engine.internal.constant.UIElement)[source]

Remove any reference to the element.

process_ui_events(event)[source]

Pass event to the gui manager.

register_element(element_type: UIElement, element: Union[Panel, Window])[source]

Register the specified UI element. Can be returned with get_element at a later date. If it already exists current instance will be overwritten.

set_element_visibility(element_type: scripts.engine.internal.constant.UIElement, visible: bool)bool[source]

Set whether the element is visible or not. Returns true if successful, false if element not found.

update(time_delta: float)[source]

Update all ui_manager elements