pygame / docs / ref / pygame_joystick.html

<body bgcolor=#dddddd text=#333377 link=#7777bb vlink=#7777bb>

<table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor=#f5f5f5><tr valign=top>
<td rowspan=2><table border=0 cellpadding=5 cellspacing=0 bgcolor=#333377>
<tr height=86 align=left><td valign=middle><font color=#ffffff size=+5>
	<a href=../index.html><font size=+5 color=#ffffff><i><b>
<td valign=middle><tt><font color=#dddddd><br>
</td></tr></table></td><td width=100% align=center valign=middle>

	<a href=>Home</a> &nbsp;||&nbsp;
	<a href=../index.html>Help Contents</a> &nbsp;||

|| <a href=CD.html>CD</a> || 
<a href=Channel.html>Channel</a> || 
<a href=Font.html>Font</a> || 
<a href=Joystick.html>Joystick</a> || 
<a href=Rect.html>Rect</a> || 
<a href=Sound.html>Sound</a> || 
<a href=Surface.html>Surface</a> ||<br>
|| <a href=pygame.html>pygame</a> || 
<a href=pygame_cdrom.html>cdrom</a> || 
<a href=pygame_constants.html>constants</a> || 
<a href=pygame_display.html>display</a> || 
<a href=pygame_event.html>event</a> || 
<a href=pygame_font.html>font</a> || 
<a href=pygame_image.html>image</a> ||<br>
|| <a href=pygame_joystick.html>joystick</a> || 
<a href=pygame_key.html>key</a> || 
<a href=pygame_mixer.html>mixer</a> || 
<a href=pygame_mixer_music.html>mixer_music</a> || 
<a href=pygame_mouse.html>mouse</a> || 
<a href=pygame_surfarray.html>surfarray</a> || 
<a href=pygame_time.html>time</a> ||<br>

<h2 align=center>pygame.joystick</h2>
The joystick module provides a few functions to initialize
the joystick subsystem and to manage the Joystick objects. These
objects are created with the pygame.joystick.Joystick() function.
This function needs a joystick device number to work on. All
joystick devices on the system are enumerated for use as a Joystick
object. To access most of the Joystick functions, you'll need to
Init() the Joystick. (note that the joystick module will already
be initialized). When multiple Joysticks objects are created for the
same joystick device, the state and values for those Joystick objects
will be shared.
You can call the Joystick.get_name() and Joystick.get_id() functions
without initializing the Joystick object.
Joystick control values are only updated during the calls to the event
queue. Call pygame.event.pump() if you are not using the event queue for
any input handling. Once a joystick object has been initialized, it will
start to send joystick events to the input queue.
Be sure to understand the difference between the joystick module
and the Joystick objects.


<tr><td><a href=#Joystick>Joystick</a></td><td> -
create new joystick object</td></tr>

<tr><td><a href=#get_count>get_count</a></td><td> -
query number of joysticks on system</td></tr>

<tr><td><a href=#get_init>get_init</a></td><td> -
query initialization of joystick module</td></tr>

<tr><td><a href=#init>init</a></td><td> -
initialize joystick module</td></tr>

<tr><td><a href=#quit>quit</a></td><td> -
uninitialize joystick module</td></tr>



<a name=Joystick><font size=+2><b>Joystick
</b></font><br><font size=+1><tt>
pygame.joystick.Joystick(id) -> Joystick
Creates a new joystick object for the given device id. The given id
must be less than the value from <a href=#get_count>pygame.joystick.get_count()</a>.

<a name=get_count><font size=+2><b>get_count
</b></font><br><font size=+1><tt>
pygame.joystick.get_count() -> int
Returns the number of joysticks devices available on
the system.

<a name=get_init><font size=+2><b>get_init
</b></font><br><font size=+1><tt>
pygame.joystick.get_init() -> bool
Returns true when the joystick module is initialized.

<a name=init><font size=+2><b>init
</b></font><br><font size=+1><tt>
pygame.joystick.init() -> None
Initialize the joystick module manually

<a name=quit><font size=+2><b>quit
</b></font><br><font size=+1><tt>
pygame.joystick.quit() -> None
Uninitialize the joystick module manually