expyriment.io.GamePad¶
-
class
expyriment.io.
GamePad
(gamepad_id, track_button_events=True, track_motion_events=False)[source]¶ A class for creating gamepad/joystick input.
Methods
-
__init__
(gamepad_id, track_button_events=True, track_motion_events=False)[source]¶ Create a gamepad/joystick input.
Parameters: gamepad_id : int
id of the gamepad
track_button_events : bool, optional
Track button events (default=True)
track_motion_events : bool, optional
Track motion events (default=False)
-
get_axis
(axis)[source]¶ Get current axis state.
Parameters: axis : int
axis to get the current state from
-
get_ball
(ball)[source]¶ Get current ball state.
Parameters: ball : int
ball to get the current state from
Get current button state.
Parameters: button : int
button to get the current state from
Get the number of buttons.
-
id
¶ Getter for id.
-
joystick
¶ Getter for joystick.
-
logging
¶ Getter for logging.
-
name
¶ Getter for name.
-
set_logging
(onoff)¶ Set logging of this object on or off
Parameters: onoff : bool
set logging on (True) or off (False)
Notes
See also design.experiment.set_log_level fur further information about event logging.
Getter for track_button_events.
-
track_motion_events
¶ Getter for track_motion_events.
-
wait_press
(buttons=None, duration=None)[source]¶ Wait for gamepad button press.
Returns the found button and the reaction time.
Parameters: buttons : int or list, optional
specific buttons to wait for
duration : int, optional
maximal time to wait in ms
Returns: button : int
button _id of the pressed button
rt : int
reaction time in ms
See also
design.experiment.register_wait_callback_function
-