expyriment.io.GamePad

class expyriment.io.GamePad(gamepad_id, track_button_events=True, track_motion_events=False)

A class for creating gamepad/joystick input.

Methods

__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_button(button)

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_numbuttons()

Get the number of buttons.

get_numhats()

Get the number of hats.

id

Getter for id.

joystick

Getter for joystick.

name

Getter for name.

track_button_events

Getter for track_button_events.

track_motion_events

Getter for track_motion_events.

wait_press(buttons=None, duration=None)

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

Previous topic

expyriment.io.EventFile

Next topic

expyriment.io.InputFile

This Page