.. 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.adv.Joystick:

==========================================================================================================================================
|phoenix_title|  **wx.adv.Joystick**
==========================================================================================================================================

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







         



.. seealso:: :ref:`wx.JoystickEvent`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Joystick</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.adv.Joystick_inheritance.png" alt="Inheritance diagram of Joystick" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.adv.Joystick.html" title="wx.adv.Joystick" alt="" coords="5,83,128,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="23,5,110,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

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


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.adv.Joystick.ButtonState`                                             See :meth:`~wx.adv.Joystick.GetButtonState`
:attr:`~wx.adv.Joystick.ManufacturerId`                                          See :meth:`~wx.adv.Joystick.GetManufacturerId`
:attr:`~wx.adv.Joystick.MaxAxes`                                                 See :meth:`~wx.adv.Joystick.GetMaxAxes`
:attr:`~wx.adv.Joystick.MaxButtons`                                              See :meth:`~wx.adv.Joystick.GetMaxButtons`
:attr:`~wx.adv.Joystick.MovementThreshold`                                       See :meth:`~wx.adv.Joystick.GetMovementThreshold` and :meth:`~wx.adv.Joystick.SetMovementThreshold`
:attr:`~wx.adv.Joystick.NumberAxes`                                              See :meth:`~wx.adv.Joystick.GetNumberAxes`
:attr:`~wx.adv.Joystick.NumberButtons`                                           See :meth:`~wx.adv.Joystick.GetNumberButtons`
:attr:`~wx.adv.Joystick.POVCTSPosition`                                          See :meth:`~wx.adv.Joystick.GetPOVCTSPosition`
:attr:`~wx.adv.Joystick.POVPosition`                                             See :meth:`~wx.adv.Joystick.GetPOVPosition`
:attr:`~wx.adv.Joystick.PollingMax`                                              See :meth:`~wx.adv.Joystick.GetPollingMax`
:attr:`~wx.adv.Joystick.PollingMin`                                              See :meth:`~wx.adv.Joystick.GetPollingMin`
:attr:`~wx.adv.Joystick.Position`                                                See :meth:`~wx.adv.Joystick.GetPosition`
:attr:`~wx.adv.Joystick.ProductId`                                               See :meth:`~wx.adv.Joystick.GetProductId`
:attr:`~wx.adv.Joystick.ProductName`                                             See :meth:`~wx.adv.Joystick.GetProductName`
:attr:`~wx.adv.Joystick.RudderMax`                                               See :meth:`~wx.adv.Joystick.GetRudderMax`
:attr:`~wx.adv.Joystick.RudderMin`                                               See :meth:`~wx.adv.Joystick.GetRudderMin`
:attr:`~wx.adv.Joystick.RudderPosition`                                          See :meth:`~wx.adv.Joystick.GetRudderPosition`
:attr:`~wx.adv.Joystick.UMax`                                                    See :meth:`~wx.adv.Joystick.GetUMax`
:attr:`~wx.adv.Joystick.UMin`                                                    See :meth:`~wx.adv.Joystick.GetUMin`
:attr:`~wx.adv.Joystick.UPosition`                                               See :meth:`~wx.adv.Joystick.GetUPosition`
:attr:`~wx.adv.Joystick.VMax`                                                    See :meth:`~wx.adv.Joystick.GetVMax`
:attr:`~wx.adv.Joystick.VMin`                                                    See :meth:`~wx.adv.Joystick.GetVMin`
:attr:`~wx.adv.Joystick.VPosition`                                               See :meth:`~wx.adv.Joystick.GetVPosition`
:attr:`~wx.adv.Joystick.XMax`                                                    See :meth:`~wx.adv.Joystick.GetXMax`
:attr:`~wx.adv.Joystick.XMin`                                                    See :meth:`~wx.adv.Joystick.GetXMin`
:attr:`~wx.adv.Joystick.YMax`                                                    See :meth:`~wx.adv.Joystick.GetYMax`
:attr:`~wx.adv.Joystick.YMin`                                                    See :meth:`~wx.adv.Joystick.GetYMin`
:attr:`~wx.adv.Joystick.ZMax`                                                    See :meth:`~wx.adv.Joystick.GetZMax`
:attr:`~wx.adv.Joystick.ZMin`                                                    See :meth:`~wx.adv.Joystick.GetZMin`
:attr:`~wx.adv.Joystick.ZPosition`                                               See :meth:`~wx.adv.Joystick.GetZPosition`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.adv.Joystick(Object)

   **Possible constructors**::

       Joystick(joystick=JOYSTICK1)
       
   
   Joystick allows an application to control one or more joysticks.



   .. method:: __init__(self, joystick=JOYSTICK1)

      Constructor.                  

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


      :param `joystick`: 
      :type `joystick`: int







   .. method:: GetButtonState(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **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.                  
      
      :rtype: `int`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **GetButtonState** `(self, id)`
      
      Returns the state of the specified joystick button.                  
      
      
      
      
      :param `id`: The button id to report, from 0 to :meth:`GetNumberButtons`   - 1   
      :type `id`: int
      
      
      
      
      
      
      :rtype: `bool`
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: GetManufacturerId(self)

      Returns the manufacturer id.                  

      :rtype: `int`








   .. method:: GetMaxAxes(self)



      :rtype: `int`








   .. method:: GetMaxButtons(self)



      :rtype: `int`








   .. method:: GetMovementThreshold(self)

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

      :rtype: `int`








   .. method:: GetNumberAxes(self)

      Returns the number of axes for this joystick.                  

      :rtype: `int`








   .. method:: GetNumberButtons(self)

      Returns the number of buttons for this joystick.                  

      :rtype: `int`








   .. staticmethod:: GetNumberJoysticks()

      Returns the number of joysticks currently attached to the computer.                  

      :rtype: `int`








   .. method:: GetPOVCTSPosition(self)

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

      Returns -1 on error.                  

      :rtype: `int`








   .. method:: 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.                  

      :rtype: `int`








   .. method:: GetPollingMax(self)

      Returns the maximum polling frequency.                  

      :rtype: `int`








   .. method:: GetPollingMin(self)

      Returns the minimum polling frequency.                  

      :rtype: `int`








   .. method:: GetPosition(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **GetPosition** `(self)`
      
      Returns the x, y position of the joystick.                  
      
      :rtype: :ref:`Point`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **GetPosition** `(self, axis)`
      
      Returns the position of the specified joystick axis.                  
      
      
      
      
      :param `axis`: The joystick axis to report, from 0 to :meth:`GetNumberAxes`   - 1.   
      :type `axis`: int
      
      
      
      
      
      
      :rtype: `int`
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: GetProductId(self)

      Returns the product id for the joystick.                  

      :rtype: `int`








   .. method:: GetProductName(self)

      Returns the product name for the joystick.                  

      :rtype: `string`








   .. method:: GetRudderMax(self)

      Returns the maximum rudder position.                  

      :rtype: `int`








   .. method:: GetRudderMin(self)

      Returns the minimum rudder position.                  

      :rtype: `int`








   .. method:: GetRudderPosition(self)

      Returns the rudder position.                  

      :rtype: `int`








   .. method:: GetUMax(self)

      Returns the maximum U position.                  

      :rtype: `int`








   .. method:: GetUMin(self)

      Returns the minimum U position.                  

      :rtype: `int`








   .. method:: GetUPosition(self)

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

      :rtype: `int`








   .. method:: GetVMax(self)

      Returns the maximum V position.                  

      :rtype: `int`








   .. method:: GetVMin(self)

      Returns the minimum V position.                  

      :rtype: `int`








   .. method:: GetVPosition(self)

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

      :rtype: `int`








   .. method:: GetXMax(self)

      Returns the maximum x position.                  

      :rtype: `int`








   .. method:: GetXMin(self)

      Returns the minimum x position.                  

      :rtype: `int`








   .. method:: GetYMax(self)

      Returns the maximum y position.                  

      :rtype: `int`








   .. method:: GetYMin(self)

      Returns the minimum y position.                  

      :rtype: `int`








   .. method:: GetZMax(self)

      Returns the maximum z position.                  

      :rtype: `int`








   .. method:: GetZMin(self)

      Returns the minimum z position.                  

      :rtype: `int`








   .. method:: GetZPosition(self)

      Returns the z position of the joystick.                  

      :rtype: `int`








   .. method:: HasPOV(self)

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

      :rtype: `bool`








   .. method:: HasPOV4Dir(self)

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

      :rtype: `bool`








   .. method:: HasPOVCTS(self)

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

      :rtype: `bool`








   .. method:: HasRudder(self)

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

      :rtype: `bool`








   .. method:: HasU(self)

      Returns ``True`` if the joystick has a U axis.                  

      :rtype: `bool`








   .. method:: HasV(self)

      Returns ``True`` if the joystick has a V axis.                  

      :rtype: `bool`








   .. method:: HasZ(self)

      Returns ``True`` if the joystick has a Z axis.                  

      :rtype: `bool`








   .. method:: IsOk(self)

      Returns ``True`` if the joystick is functioning.                  

      :rtype: `bool`








   .. method:: ReleaseCapture(self)

      Releases the capture set by **SetCapture**.                  

                

      :rtype: `bool`







      :returns: 

         ``True`` if the capture release succeeded.  







      .. seealso:: :meth:`SetCapture` , :ref:`wx.JoystickEvent`    








   .. method:: SetCapture(self, win, pollingFreq=0)

      Sets the capture to direct joystick events to `win`.                  




      :param `win`: The window that will receive joystick events.   
      :type `win`: wx.Window
      :param `pollingFreq`: If zero, movement events are sent when above the threshold. If greater than zero, events are received every  `pollingFreq`  milliseconds.  
      :type `pollingFreq`: int








      :rtype: `bool`



                  



      :returns: 

         ``True`` if the capture succeeded.  







      .. seealso:: :meth:`ReleaseCapture` , :ref:`wx.JoystickEvent`    








   .. method:: SetMovementThreshold(self, threshold)

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


      :param `threshold`: 
      :type `threshold`: int







   .. attribute:: ButtonState

      See :meth:`~wx.adv.Joystick.GetButtonState`


   .. attribute:: ManufacturerId

      See :meth:`~wx.adv.Joystick.GetManufacturerId`


   .. attribute:: MaxAxes

      See :meth:`~wx.adv.Joystick.GetMaxAxes`


   .. attribute:: MaxButtons

      See :meth:`~wx.adv.Joystick.GetMaxButtons`


   .. attribute:: MovementThreshold

      See :meth:`~wx.adv.Joystick.GetMovementThreshold` and :meth:`~wx.adv.Joystick.SetMovementThreshold`


   .. attribute:: NumberAxes

      See :meth:`~wx.adv.Joystick.GetNumberAxes`


   .. attribute:: NumberButtons

      See :meth:`~wx.adv.Joystick.GetNumberButtons`


   .. attribute:: POVCTSPosition

      See :meth:`~wx.adv.Joystick.GetPOVCTSPosition`


   .. attribute:: POVPosition

      See :meth:`~wx.adv.Joystick.GetPOVPosition`


   .. attribute:: PollingMax

      See :meth:`~wx.adv.Joystick.GetPollingMax`


   .. attribute:: PollingMin

      See :meth:`~wx.adv.Joystick.GetPollingMin`


   .. attribute:: Position

      See :meth:`~wx.adv.Joystick.GetPosition`


   .. attribute:: ProductId

      See :meth:`~wx.adv.Joystick.GetProductId`


   .. attribute:: ProductName

      See :meth:`~wx.adv.Joystick.GetProductName`


   .. attribute:: RudderMax

      See :meth:`~wx.adv.Joystick.GetRudderMax`


   .. attribute:: RudderMin

      See :meth:`~wx.adv.Joystick.GetRudderMin`


   .. attribute:: RudderPosition

      See :meth:`~wx.adv.Joystick.GetRudderPosition`


   .. attribute:: UMax

      See :meth:`~wx.adv.Joystick.GetUMax`


   .. attribute:: UMin

      See :meth:`~wx.adv.Joystick.GetUMin`


   .. attribute:: UPosition

      See :meth:`~wx.adv.Joystick.GetUPosition`


   .. attribute:: VMax

      See :meth:`~wx.adv.Joystick.GetVMax`


   .. attribute:: VMin

      See :meth:`~wx.adv.Joystick.GetVMin`


   .. attribute:: VPosition

      See :meth:`~wx.adv.Joystick.GetVPosition`


   .. attribute:: XMax

      See :meth:`~wx.adv.Joystick.GetXMax`


   .. attribute:: XMin

      See :meth:`~wx.adv.Joystick.GetXMin`


   .. attribute:: YMax

      See :meth:`~wx.adv.Joystick.GetYMax`


   .. attribute:: YMin

      See :meth:`~wx.adv.Joystick.GetYMin`


   .. attribute:: ZMax

      See :meth:`~wx.adv.Joystick.GetZMax`


   .. attribute:: ZMin

      See :meth:`~wx.adv.Joystick.GetZMin`


   .. attribute:: ZPosition

      See :meth:`~wx.adv.Joystick.GetZPosition`

