.. include:: headings.inc .. _JoystickEvent: ========================================================================================================================================== |phoenix_title| **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:`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:`adv.Joystick` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **JoystickEvent** .. raw:: html

Inheritance diagram of JoystickEvent

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~JoystickEvent.__init__` Constructor. :meth:`~JoystickEvent.ButtonDown` Returns ``True`` if the event was a down event from the specified button (or any button). :meth:`~JoystickEvent.ButtonIsDown` Returns ``True`` if the specified button (or any button) was in a down state. :meth:`~JoystickEvent.ButtonUp` Returns ``True`` if the event was an up event from the specified button (or any button). :meth:`~JoystickEvent.GetButtonChange` Returns the identifier of the button changing state. :meth:`~JoystickEvent.GetButtonState` Returns the down state of the buttons. :meth:`~JoystickEvent.GetJoystick` Returns the identifier of the joystick generating the event - one of ``JOYSTICK1`` and ``JOYSTICK2``. :meth:`~JoystickEvent.GetPosition` Returns the x, y position of the joystick event. :meth:`~JoystickEvent.GetZPosition` Returns the z position of the joystick event. :meth:`~JoystickEvent.IsButton` Returns ``True`` if this was a button up or down event (`not` 'is any button down?'). :meth:`~JoystickEvent.IsMove` Returns ``True`` if this was an x, y move event. :meth:`~JoystickEvent.IsZMove` Returns ``True`` if this was a z move event. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~JoystickEvent.ButtonChange` See :meth:`~JoystickEvent.GetButtonChange` :attr:`~JoystickEvent.ButtonState` See :meth:`~JoystickEvent.GetButtonState` :attr:`~JoystickEvent.Joystick` See :meth:`~JoystickEvent.GetJoystick` :attr:`~JoystickEvent.Position` See :meth:`~JoystickEvent.GetPosition` :attr:`~JoystickEvent.ZPosition` See :meth:`~JoystickEvent.GetZPosition` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: JoystickEvent(Event) This event class contains information about joystick events, particularly events received by windows. **Possible constructors**:: JoystickEvent(eventType=wxEVT_NULL, state=0, joystick=JOYSTICK1, change=0) .. method:: __init__(self, eventType=wxEVT_NULL, state=0, joystick=JOYSTICK1, change=0) Constructor. :param `eventType`: :type `eventType`: EventType :param `state`: :type `state`: int :param `joystick`: :type `joystick`: int :param `change`: :type `change`: int .. method:: ButtonDown(self, button=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=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=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. This is a ``JOY_BUTTONn`` identifier, where ``n`` is one of 1, 2, 3, 4. :rtype: `int` .. 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 ``JOYSTICK1`` and ``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:`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:`~JoystickEvent.GetButtonChange` .. attribute:: ButtonState See :meth:`~JoystickEvent.GetButtonState` .. attribute:: Joystick See :meth:`~JoystickEvent.GetJoystick` .. attribute:: Position See :meth:`~JoystickEvent.GetPosition` .. attribute:: ZPosition See :meth:`~JoystickEvent.GetZPosition`