<html> <title>pygame.joystick</title> <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111> <table cellspacing=3 width=100%><tr><td bgcolor=#00000> <table width=100%><tr><td bgcolor=c2fc20 align=center> <a href=http://www.pygame.org> <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br> <b>pygame documentation</b> </td><td bgcolor=6aee28 align=center valign=top width=100%> || <a href=http://www.pygame.org>Home</a> || <a href=../index.html>Help Contents</a> || <br> <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_draw.html>draw</a> || <a href=pygame_event.html>event</a> ||<br> || <a href=pygame_font.html>font</a> || <a href=pygame_image.html>image</a> || <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> ||<br> || <a href=pygame_mouse.html>mouse</a> || <a href=pygame_movie.html>movie</a> || <a href=pygame_sndarray.html>sndarray</a> || <a href=pygame_surfarray.html>surfarray</a> || <a href=pygame_time.html>time</a> || <a href=pygame_transform.html>transform</a> ||<br> <br>|| <a href=CD.html>CD</a> || <a href=Channel.html>Channel</a> || <a href=Clock.html>Clock</a> || <a href=Font.html>Font</a> || <a href=Joystick.html>Joystick</a> || <a href=Movie.html>Movie</a> ||<br> || <a href=Rect.html>Rect</a> || <a href=Sound.html>Sound</a> || <a href=Surface.html>Surface</a> ||<br> <br>|| <a href=pygame_cursors.html>cursors</a> || <a href=pygame_sprite.html>sprite</a> ||<br> </td></tr></table></td></tr></table> <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 <a href=#Joystick>pygame.joystick.Joystick()</a> 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 <a href=pygame_display.html#init>init()</a> 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. <br> <br> You can call the <a href=Joystick.html#get_name>Joystick.get_name()</a> and <a href=Joystick.html#get_id>Joystick.get_id()</a> functions without initializing the Joystick object. <br> <br> Joystick control values are only updated during the calls to the event queue. Call <a href=pygame_event.html#pump>pygame.event.pump()</a> 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. <br> <br> Be sure to understand there is a difference between the joystick module and the Joystick objects. <hr> <table> <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> </table> <hr> <a name=Joystick><font size=+2><b>Joystick </b></font><br><font size=+1><tt> pygame.joystick.Joystick(id) -> Joystick </tt></font><ul> 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>. </ul><br> <br> <a name=get_count><font size=+2><b>get_count </b></font><br><font size=+1><tt> pygame.joystick.get_count() -> int </tt></font><ul> Returns the number of joysticks devices available on the system. </ul><br> <br> <a name=get_init><font size=+2><b>get_init </b></font><br><font size=+1><tt> pygame.joystick.get_init() -> bool </tt></font><ul> Returns true when the joystick module is initialized. </ul><br> <br> <a name=init><font size=+2><b>init </b></font><br><font size=+1><tt> pygame.joystick.init() -> None </tt></font><ul> Initialize the joystick module manually </ul><br> <br> <a name=quit><font size=+2><b>quit </b></font><br><font size=+1><tt> pygame.joystick.quit() -> None </tt></font><ul> Uninitialize the joystick module manually </ul><br> <br> <hr> </body></html>