input_handler

</> ursina.input_handler

Variables

.held_keys

default: defaultdict(lambda: 0)


.rebinds

default: dict()


Functions

bind()

bind(original_key=None, alternative_key=None)


unbind()

unbind(key=None)


rebind()

rebind(to_key=None, from_key=None)


input()

input(key=None)


get_combined_key()

get_combined_key(key=None)


Examples


from ursina import * from ursina import Ursina, input_handler app = Ursina(borderless=False) input_handler.bind('z', 'w')  # 'z'-key will now be registered as 'w'-key input_handler.bind('left mouse down', 'attack')  # 'left mouse down'-key will now send 'attack'to input functions input_handler.bind('gamepad b', 'attack')  # 'gamepad b'-key will now be registered as 'attack'-key def input(key):     print('got key:', key)     if key == 'attack':         destroy(Entity(model='cube', color=color.blue), delay=.2) app.run()