Phoenix Logo

phoenix_title wx.adv.Joystick

wx.adv.Joystick allows an application to control one or more joysticks.


class_hierarchy Class Hierarchy

Inheritance diagram for class Joystick:

method_summary Methods Summary

__init__ Constructor.
GetButtonState Returns the state of the joystick buttons.
GetManufacturerId Returns the manufacturer id.
GetMovementThreshold Returns the movement threshold, the number of steps outside which the joystick is deemed to have moved.
GetNumberAxes Returns the number of axes for this joystick.
GetNumberButtons Returns the number of buttons for this joystick.
GetNumberJoysticks Returns the number of joysticks currently attached to the computer.
GetPOVCTSPosition Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units.
GetPOVPosition Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units, but limited to return 0, 9000, 18000 or 27000.
GetPollingMax Returns the maximum polling frequency.
GetPollingMin Returns the minimum polling frequency.
GetPosition Returns the x, y position of the joystick.
GetProductId Returns the product id for the joystick.
GetProductName Returns the product name for the joystick.
GetRudderMax Returns the maximum rudder position.
GetRudderMin Returns the minimum rudder position.
GetRudderPosition Returns the rudder position.
GetUMax Returns the maximum U position.
GetUMin Returns the minimum U position.
GetUPosition Gets the position of the fifth axis of the joystick, if it exists.
GetVMax Returns the maximum V position.
GetVMin Returns the minimum V position.
GetVPosition Gets the position of the sixth axis of the joystick, if it exists.
GetXMax Returns the maximum x position.
GetXMin Returns the minimum x position.
GetYMax Returns the maximum y position.
GetYMin Returns the minimum y position.
GetZMax Returns the maximum z position.
GetZMin Returns the minimum z position.
GetZPosition Returns the z position of the joystick.
HasPOV Returns True if the joystick has a point of view control.
HasPOV4Dir Returns True if the joystick point-of-view supports discrete values (centered, forward, backward, left, and right).
HasPOVCTS Returns True if the joystick point-of-view supports continuous degree bearings.
HasRudder Returns True if there is a rudder attached to the computer.
HasU Returns True if the joystick has a U axis.
HasV Returns True if the joystick has a V axis.
HasZ Returns True if the joystick has a Z axis.
IsOk Returns True if the joystick is functioning.
ReleaseCapture Releases the capture set by SetCapture.
SetCapture Sets the capture to direct joystick events to win.
SetMovementThreshold Sets the movement threshold, the number of steps outside which the joystick is deemed to have moved.

api Class API



class wx.adv.Joystick(Object)

Possible constructors:

Joystick(joystick=JOYSTICK1)

Joystick allows an application to control one or more joysticks.


Methods



__init__(self, joystick=JOYSTICK1)

Constructor.

joystick may be one of wx.JOYSTICK1, wx.JOYSTICK2, indicating the joystick controller of interest.

Parameters:joystick (int) –


GetButtonState(self, *args, **kw)

overload Overloaded Implementations:



GetButtonState (self)

Returns the state of the joystick buttons.

Every button is mapped to a single bit in the returned integer, with the first button being mapped to the least significant bit, and so on.

A bitlist of JOY_BUTTONn identifiers, where n is 1, 2, 3 or 4 is available for historical reasons.

Return type:int



GetButtonState (self, id)

Returns the state of the specified joystick button.

Parameters:id (int) – The button id to report, from 0 to GetNumberButtons - 1
Return type:bool





GetManufacturerId(self)

Returns the manufacturer id.

Return type:int


GetMovementThreshold(self)

Returns the movement threshold, the number of steps outside which the joystick is deemed to have moved.

Return type:int


GetNumberAxes(self)

Returns the number of axes for this joystick.

Return type:int


GetNumberButtons(self)

Returns the number of buttons for this joystick.

Return type:int


static GetNumberJoysticks()

Returns the number of joysticks currently attached to the computer.

Return type:int


GetPOVCTSPosition(self)

Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units.

Returns -1 on error.

Return type:int


GetPOVPosition(self)

Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units, but limited to return 0, 9000, 18000 or 27000.

Returns -1 on error.

Return type:int


GetPollingMax(self)

Returns the maximum polling frequency.

Return type:int


GetPollingMin(self)

Returns the minimum polling frequency.

Return type:int


GetPosition(self, *args, **kw)

overload Overloaded Implementations:



GetPosition (self)

Returns the x, y position of the joystick.

Return type:Point



GetPosition (self, axis)

Returns the position of the specified joystick axis.

Parameters:axis (int) – The joystick axis to report, from 0 to GetNumberAxes - 1.
Return type:int





GetProductId(self)

Returns the product id for the joystick.

Return type:int


GetProductName(self)

Returns the product name for the joystick.

Return type:string


GetRudderMax(self)

Returns the maximum rudder position.

Return type:int


GetRudderMin(self)

Returns the minimum rudder position.

Return type:int


GetRudderPosition(self)

Returns the rudder position.

Return type:int


GetUMax(self)

Returns the maximum U position.

Return type:int


GetUMin(self)

Returns the minimum U position.

Return type:int


GetUPosition(self)

Gets the position of the fifth axis of the joystick, if it exists.

Return type:int


GetVMax(self)

Returns the maximum V position.

Return type:int


GetVMin(self)

Returns the minimum V position.

Return type:int


GetVPosition(self)

Gets the position of the sixth axis of the joystick, if it exists.

Return type:int


GetXMax(self)

Returns the maximum x position.

Return type:int


GetXMin(self)

Returns the minimum x position.

Return type:int


GetYMax(self)

Returns the maximum y position.

Return type:int


GetYMin(self)

Returns the minimum y position.

Return type:int


GetZMax(self)

Returns the maximum z position.

Return type:int


GetZMin(self)

Returns the minimum z position.

Return type:int


GetZPosition(self)

Returns the z position of the joystick.

Return type:int


HasPOV(self)

Returns True if the joystick has a point of view control.

Return type:bool


HasPOV4Dir(self)

Returns True if the joystick point-of-view supports discrete values (centered, forward, backward, left, and right).

Return type:bool


HasPOVCTS(self)

Returns True if the joystick point-of-view supports continuous degree bearings.

Return type:bool


HasRudder(self)

Returns True if there is a rudder attached to the computer.

Return type:bool


HasU(self)

Returns True if the joystick has a U axis.

Return type:bool


HasV(self)

Returns True if the joystick has a V axis.

Return type:bool


HasZ(self)

Returns True if the joystick has a Z axis.

Return type:bool


IsOk(self)

Returns True if the joystick is functioning.

Return type:bool


ReleaseCapture(self)

Releases the capture set by SetCapture.

Return type:bool
Returns:True if the capture release succeeded.


SetCapture(self, win, pollingFreq=0)

Sets the capture to direct joystick events to win.

Parameters:
  • win (wx.Window) – The window that will receive joystick events.
  • pollingFreq (int) – If zero, movement events are sent when above the threshold. If greater than zero, events are received every pollingFreq milliseconds.
Return type:

bool

Returns:

True if the capture succeeded.



SetMovementThreshold(self, threshold)

Sets the movement threshold, the number of steps outside which the joystick is deemed to have moved.

Parameters:threshold (int) –

Properties



ButtonState

See GetButtonState



ManufacturerId

See GetManufacturerId



MovementThreshold

See GetMovementThreshold and SetMovementThreshold



NumberAxes

See GetNumberAxes



NumberButtons

See GetNumberButtons



POVCTSPosition

See GetPOVCTSPosition



POVPosition

See GetPOVPosition



PollingMax

See GetPollingMax



PollingMin

See GetPollingMin



Position

See GetPosition



ProductId

See GetProductId



ProductName

See GetProductName



RudderMax

See GetRudderMax



RudderMin

See GetRudderMin



RudderPosition

See GetRudderPosition



UMax

See GetUMax



UMin

See GetUMin



UPosition

See GetUPosition



VMax

See GetVMax



VMin

See GetVMin



VPosition

See GetVPosition



XMax

See GetXMax



XMin

See GetXMin



YMax

See GetYMax



YMin

See GetYMin



ZMax

See GetZMax



ZMin

See GetZMin



ZPosition

See GetZPosition