.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.JoystickEvent:
==========================================================================================================================================
|phoenix_title| **wx.JoystickEvent**
==========================================================================================================================================
This event class contains information about joystick events, particularly events received by windows.
.. _JoystickEvent-events:
|events| Events Emitted by this Class
=====================================
Handlers bound for the following event types will receive a :ref:`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.
.. seealso:: :ref:`wx.adv.Joystick`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
JoystickEvent:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.JoystickEvent.__init__` Constructor.
:meth:`~wx.JoystickEvent.ButtonDown` Returns ``True`` if the event was a down event from the specified button (or any button).
:meth:`~wx.JoystickEvent.ButtonIsDown` Returns ``True`` if the specified button (or any button) was in a down state.
:meth:`~wx.JoystickEvent.ButtonUp` Returns ``True`` if the event was an up event from the specified button (or any button).
:meth:`~wx.JoystickEvent.GetButtonChange` Returns the identifier of the button changing state.
:meth:`~wx.JoystickEvent.GetButtonOrdinal` Returns the 0-indexed ordinal of the button changing state.
:meth:`~wx.JoystickEvent.GetButtonState` Returns the down state of the buttons.
:meth:`~wx.JoystickEvent.GetJoystick` Returns the identifier of the joystick generating the event - one of ``wx.JOYSTICK1`` and ``wx.JOYSTICK2``.
:meth:`~wx.JoystickEvent.GetPosition` Returns the x, y position of the joystick event.
:meth:`~wx.JoystickEvent.GetZPosition` Returns the z position of the joystick event.
:meth:`~wx.JoystickEvent.IsButton` Returns ``True`` if this was a button up or down event (`not` 'is any button down?').
:meth:`~wx.JoystickEvent.IsMove` Returns ``True`` if this was an x, y move event.
:meth:`~wx.JoystickEvent.IsZMove` Returns ``True`` if this was a z move event.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.JoystickEvent.ButtonChange` See :meth:`~wx.JoystickEvent.GetButtonChange`
:attr:`~wx.JoystickEvent.ButtonOrdinal` See :meth:`~wx.JoystickEvent.GetButtonOrdinal`
:attr:`~wx.JoystickEvent.ButtonState` See :meth:`~wx.JoystickEvent.GetButtonState`
:attr:`~wx.JoystickEvent.Joystick` See :meth:`~wx.JoystickEvent.GetJoystick`
:attr:`~wx.JoystickEvent.Position` See :meth:`~wx.JoystickEvent.GetPosition`
:attr:`~wx.JoystickEvent.ZPosition` See :meth:`~wx.JoystickEvent.GetZPosition`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.JoystickEvent(Event)
**Possible constructors**::
JoystickEvent(eventType: EventType=wxEVT_NULL, state: int=0, joystick:
int=JOYSTICK1, change: int=0) -> None
This event class contains information about joystick events,
particularly events received by windows.
.. method:: __init__(self, eventType: EventType=wxEVT_NULL, state: int=0, joystick: int=JOYSTICK1, change: int=0)
Constructor.
:param `eventType`:
:type `eventType`: wx.EventType
:param `state`:
:type `state`: int
:param `joystick`:
:type `joystick`: int
:param `change`:
:type `change`: int
:rtype: `None`
.. method:: ButtonDown(self, button: int=JOY_BUTTON_ANY)
Returns ``True`` if the event was a down event from the specified button (or any button).
:param `button`: Can be ``JOY_BUTTONn`` where ``n`` is 1, 2, 3 or 4; or ``JOY_BUTTON_ANY`` to indicate any button down event.
:type `button`: int
:rtype: `bool`
.. method:: ButtonIsDown(self, button: int=JOY_BUTTON_ANY)
Returns ``True`` if the specified button (or any button) was in a down state.
:param `button`: Can be ``JOY_BUTTONn`` where ``n`` is 1, 2, 3 or 4; or ``JOY_BUTTON_ANY`` to indicate any button down event.
:type `button`: int
:rtype: `bool`
.. method:: ButtonUp(self, button: int=JOY_BUTTON_ANY)
Returns ``True`` if the event was an up event from the specified button (or any button).
:param `button`: Can be ``JOY_BUTTONn`` where ``n`` is 1, 2, 3 or 4; or ``JOY_BUTTON_ANY`` to indicate any button down event.
:type `button`: int
:rtype: `bool`
.. method:: 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 :meth:`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.
:rtype: `int`
.. method:: GetButtonOrdinal(self)
Returns the 0-indexed ordinal of the button changing state.
:rtype: `int`
.. versionadded:: 4.1/wxWidgets-3.1.2 .
.. seealso:: :meth:`GetButtonChange`
.. method:: GetButtonState(self)
Returns the down state of the buttons.
This is a ``JOY_BUTTONn`` identifier, where ``n`` is one of 1, 2, 3, 4.
:rtype: `int`
.. method:: GetJoystick(self)
Returns the identifier of the joystick generating the event - one of ``wx.JOYSTICK1`` and ``wx.JOYSTICK2``.
:rtype: `int`
.. method:: GetPosition(self)
Returns the x, y position of the joystick event.
These coordinates are valid for all the events except wxEVT_JOY_ZMOVE.
:rtype: :ref:`wx.Point`
.. method:: GetZPosition(self)
Returns the z position of the joystick event.
This method can only be used for wxEVT_JOY_ZMOVE events.
:rtype: `int`
.. method:: IsButton(self)
Returns ``True`` if this was a button up or down event (`not` 'is any button down?').
:rtype: `bool`
.. method:: IsMove(self)
Returns ``True`` if this was an x, y move event.
:rtype: `bool`
.. method:: IsZMove(self)
Returns ``True`` if this was a z move event.
:rtype: `bool`
.. attribute:: ButtonChange
See :meth:`~wx.JoystickEvent.GetButtonChange`
.. attribute:: ButtonOrdinal
See :meth:`~wx.JoystickEvent.GetButtonOrdinal`
.. attribute:: ButtonState
See :meth:`~wx.JoystickEvent.GetButtonState`
.. attribute:: Joystick
See :meth:`~wx.JoystickEvent.GetJoystick`
.. attribute:: Position
See :meth:`~wx.JoystickEvent.GetPosition`
.. attribute:: ZPosition
See :meth:`~wx.JoystickEvent.GetZPosition`