phoenix_title wx.JoystickEvent

This event class contains information about joystick events, particularly events received by windows.

^^

events Events Emitted by this Class

Handlers bound for the following event types will receive a wx.JoystickEvent parameter.

  • EVT_JOY_BUTTON_DOWN: Process a wxEVT_JOY_BUTTON_DOWN event.

  • EVT_JOY_BUTTON_UP: Process a wxEVT_JOY_BUTTON_UP event.

  • EVT_JOY_MOVE: Process a wxEVT_JOY_MOVE event.

  • EVT_JOY_ZMOVE: Process a wxEVT_JOY_ZMOVE event.

  • EVT_JOYSTICK_EVENTS: Processes all joystick events. ^^


class_hierarchy Class Hierarchy

Inheritance diagram for class JoystickEvent:

method_summary Methods Summary

__init__

Constructor.

ButtonDown

Returns True if the event was a down event from the specified button (or any button).

ButtonIsDown

Returns True if the specified button (or any button) was in a down state.

ButtonUp

Returns True if the event was an up event from the specified button (or any button).

GetButtonChange

Returns the identifier of the button changing state.

GetButtonOrdinal

Returns the 0-indexed ordinal of the button changing state.

GetButtonState

Returns the down state of the buttons.

GetJoystick

Returns the identifier of the joystick generating the event - one of wx.JOYSTICK1 and wx.JOYSTICK2.

GetPosition

Returns the x, y position of the joystick event.

GetZPosition

Returns the z position of the joystick event.

IsButton

Returns True if this was a button up or down event (not ‘is any button down?’).

IsMove

Returns True if this was an x, y move event.

IsZMove

Returns True if this was a z move event.


api Class API

class wx.JoystickEvent(Event)

Possible constructors:

JoystickEvent(eventType=wxEVT_NULL, state=0, joystick=JOYSTICK1,
              change=0)

This event class contains information about joystick events, particularly events received by windows.


Methods

__init__(self, eventType=wxEVT_NULL, state=0, joystick=JOYSTICK1, change=0)

Constructor.

Parameters
  • eventType (wx.EventType) –

  • state (int) –

  • joystick (int) –

  • change (int) –



ButtonDown(self, button=JOY_BUTTON_ANY)

Returns True if the event was a down event from the specified button (or any button).

Parameters

button (int) – Can be JOY_BUTTONn where n is 1, 2, 3 or 4; or JOY_BUTTON_ANY to indicate any button down event.

Return type

bool



ButtonIsDown(self, button=JOY_BUTTON_ANY)

Returns True if the specified button (or any button) was in a down state.

Parameters

button (int) – Can be JOY_BUTTONn where n is 1, 2, 3 or 4; or JOY_BUTTON_ANY to indicate any button down event.

Return type

bool



ButtonUp(self, button=JOY_BUTTON_ANY)

Returns True if the event was an up event from the specified button (or any button).

Parameters

button (int) – Can be JOY_BUTTONn where n is 1, 2, 3 or 4; or JOY_BUTTON_ANY to indicate any button down event.

Return type

bool



GetButtonChange(self)

Returns the identifier of the button changing state.

The return value is:

1 << n

where n is the index of the button changing state, which can also be retrieved using GetButtonOrdinal .

Note that for n equal to 1, 2, 3 or 4 there are predefined JOY_BUTTONn constants which can be used for more clarity, however these constants are not defined for the buttons beyond the first four.

Return type

int



GetButtonOrdinal(self)

Returns the 0-indexed ordinal of the button changing state.

Return type

int

New in version 4.1/wxWidgets-3.1.2: .

See also

GetButtonChange



GetButtonState(self)

Returns the down state of the buttons.

This is a JOY_BUTTONn identifier, where n is one of 1, 2, 3, 4.

Return type

int



GetJoystick(self)

Returns the identifier of the joystick generating the event - one of wx.JOYSTICK1 and wx.JOYSTICK2.

Return type

int



GetPosition(self)

Returns the x, y position of the joystick event.

These coordinates are valid for all the events except wxEVT_JOY_ZMOVE.

Return type

wx.Point



GetZPosition(self)

Returns the z position of the joystick event.

This method can only be used for wxEVT_JOY_ZMOVE events.

Return type

int



IsButton(self)

Returns True if this was a button up or down event (not ‘is any button down?’).

Return type

bool



IsMove(self)

Returns True if this was an x, y move event.

Return type

bool



IsZMove(self)

Returns True if this was a z move event.

Return type

bool


Properties

ButtonChange

See GetButtonChange



ButtonOrdinal

See GetButtonOrdinal



ButtonState

See GetButtonState



Joystick

See GetJoystick



Position

See GetPosition



ZPosition

See GetZPosition