Description: The Input System is a system used to detect input. It is a simplified version of the PyQt6 Input System.
Syntax for key / mouse inputs:
on_press(self, key, func)
on_release(self, key, func)
on_hold(self, key, func)
self refers to the object instance.
key is the key or mouse button used.
Example: binding the a key to move left.
Input events from keyboard or mouse. Compatible with VertexEngine and Vertex widgets.
on_click(self, button, action, *args, **kwargs)
Example:
Buttons.on_click(play_btn, start_game)
on_double_click(self, button, action, interval=250)
Example:
Buttons.on_double_click(delete_btn, hard_delete)
on_hover(self, button, enter_action=None, leave_action=None)
Example:
Buttons.on_hover(
play_btn,
lambda: highlight(play_btn),
lambda: unhighlight(play_btn)
)
on_long_press(self, button, action, duration=600)
Example:
Buttons.on_long_press(reset_btn, factory_reset, duration=1500)
on_toggle(self, button, on_action, off_action=None)
Example:
Buttons.on_toggle(sound_btn, sound_on, sound_off)
on_click_once(self, button, action)
Example:
Buttons.on_click_once(nuke_btn, explode)
set_enabled(self, button, enabled=True)
Example:
Buttons.set_enabled(play_btn, False)
on_click_debounced(self, button, action, cooldown=500)
Example:
Buttons.on_click_debounced(save_btn, save_game, cooldown=1000)
* Recommended to pair with PyQt6