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)

clear()[source]

Clear gamepad events from cue.

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_button(button)[source]

Get current button state.

Parameters:

button : int

button to get the current state from

static get_gampad_count()[source]

Get the number of gamepads/joysticks connected to the system.

get_hat(hat)[source]

Get current hat state.

Parameters:

hat : int

hat to get the current state from

get_numaxes()[source]

Get the number of axes.

get_numballs()[source]

Get the number of balls.

get_numbuttons()[source]

Get the number of buttons.

get_numhats()[source]

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.

track_button_events

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