Reference for get_state (Trigger)
Get the state for a discrete input on a joystick-like device. This is part of the reference section.
Arc
Buffer
Data
Dialog
Ellipse
Geo Utils
Image
Joystick (future)
get_state (Trigger)
Keyboard
Line
Mouse / Touchscreen
Pixel
Rectangle
Renderers
Shape
Sound (future)
Style
System
Text
Transform
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.