pylablib.devices.Windows package

Submodules

pylablib.devices.Windows.joystick module

class pylablib.devices.Windows.joystick.TDeviceInfo(name, id, nbuttons, naxes)

Bases: tuple

id
name
naxes
nbuttons
pylablib.devices.Windows.joystick.list_joysticks()[source]

List all detected joysticks

class pylablib.devices.Windows.joystick.TJoystickEvent(kind, index, old, new, timestamp)

Bases: tuple

index
kind
new
old
timestamp
class pylablib.devices.Windows.joystick.TJoystickEventEx(kind, index, old, new, state, timestamp)

Bases: tuple

index
kind
new
old
state
timestamp
class pylablib.devices.Windows.joystick.Joystick(idx=None, expanded_events=False)[source]

Bases: IDevice

Generic Windows joystick device.

Parameters:
  • idx – joystick index (0-based) in the list returned by list_joysticks(); if None, use the first valid index.

  • expanded_events (bool) – if True, the events include the full joystick state; otherwise, they only record the change of the state at the particular event

Error = <Mock name='mock.WinMMError' id='133174544966288'>
open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

start()[source]

Start the polling loop (used for events recording)

stop()[source]

Stop the polling loop

get_device_info()[source]

Get joystick info.

Return tuple (name, id, nbuttons, naxes).

get_buttons()[source]

Get the buttons state as a list

get_axes()[source]

Get the axes state as a list

get_events(n=None, clear=True)[source]

Get recent joystick events.

Note that in order to capture events, one needs to call the start method first to start the event loop. n specifies the number of oldest uncleared events to get (by default, all events). If clear==True, remove all returned events from the queue.

apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

set_device_variable(key, value)

Set the value of a settings parameter

Module contents