expyriment.io.GamePad¶
- 
class 
expyriment.io.GamePad(gamepad_id, track_button_events=True, track_motion_events=False)¶ A class for creating gamepad/joystick input.
- 
__init__(gamepad_id, track_button_events=True, track_motion_events=False)¶ 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)
- 
clear()¶ Clear gamepad events from cue.
- 
get_axis(axis)¶ Get current axis state.
Parameters: axis : int
axis to get the current state from
- 
get_ball(ball)¶ 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
- 
static 
get_gampad_count()¶ Get the number of gamepads/joysticks connected to the system.
- 
get_hat(hat)¶ Get current hat state.
Parameters: hat : int
hat to get the current state from
- 
get_numaxes()¶ Get the number of axes.
- 
get_numballs()¶ Get the number of balls.
Get the number of buttons.
- 
get_numhats()¶ Get the number of hats.
- 
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, callback_function=None, process_control_events=True)¶ 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
callback_function : function, optional
function to repeatedly execute during waiting loop
process_control_events : bool, optional
process
io.Keyboard.process_control_keys()andio.Mouse.process_quit_event()(default = True)Returns: button : int
button _id of the pressed button
rt : int
reaction time in ms
See also
design.experiment.register_wait_callback_functionNotes
This will also by default process control events (quit and pause). Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!
-