🧪 Version 0.2.2 is our alpha release candidate. Please send us bug reports and suggestions!

Sketchingpy

Creative coding and interactive science everywhere for everyone: web, desktop, mobile, Jupyter, and more. Open source!

Reference for get_state (Trigger)

Get the state for a discrete input on a joystick-like device. This is part of the reference section.

Purpose

Get the state of a "discrete input" on a joystick-like device. Sketchingpy refers to these as triggers. For example, "push0" refers to the first push button on the device.

Snippet

Register a callback for when the state of a trigger changes on the first joystick.
def print_trigger(trigger):
print(trigger.get_name())

joysticks = sketch.get_joysticks()
first_joystick = joysticks[0]
button = first_joystick.get_trigger('button0')
button.on_state_change(print_trigger)

Availability

Not yet available. Planned for future release.

See also