input.on_key_down method

on_key_down(self, handler: Callable[[], None], key_code: KeyCode) -> None:

Triggers an event whenever the specified KeyCode is pressed down.

Note: Only one onKeyDown handler can be defined for a key at any time.

Parameters

  • handler: Callable[[], None]

    function to call. Pass null to remove the handler.

  • key_code: KeyCode

    key to press.