pygame / docs / pygame_mouse.html

<html>
<title>pygame.mouse</title>
<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 width=60%><table border=0 cellpadding=5 cellspacing=0 bgcolor=#333377>
<tr height=86 align=left><td valign=top><font color=#ffffff size=+5>
	<a href=../>
      <img src=mainlogo.gif width=300 height=100 alt="PyGame Logo" border=0></a></td>
<td valign=middle><tt><font color=#dddddd><br>
	PyGame<br>Documentation</font>
</td></tr></table></td><td width=100% height=100% align=center valign=middle>

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

|| <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> ||<br>
|| <a href=Sound.html>Sound</a> || 
<a href=Surface.html>Surface</a> || 
<a href=pygame.html>pygame</a> || 
<a href=pygame_cdrom.html>cdrom</a> || 
<a href=pygame_display.html>display</a> ||<br>
|| <a href=pygame_event.html>event</a> || 
<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> ||<br>
|| <a href=pygame_mixer.html>mixer</a> || 
<a href=pygame_mouse.html>mouse</a> || 
<a href=pygame_music.html>music</a> || 
<a href=pygame_surfarray.html>surfarray</a> || 
<a href=pygame_time.html>time</a> ||<br>


</td></tr></table>
<br>
<h2 align=center>pygame.mouse</h2>
Contains routines for dealing with the mouse.

<hr>

<table>
<tr><td><a href=#get_focused>get_focused</a></td><td> -
state of mouse input focus</td></tr>


<tr><td><a href=#get_pos>get_pos</a></td><td> -
gets the cursor position</td></tr>


<tr><td><a href=#get_pressed>get_pressed</a></td><td> -
state of the mouse buttons</td></tr>


<tr><td><a href=#get_rel>get_rel</a></td><td> -
gets the movement of the mouse</td></tr>


<tr><td><a href=#set_pos>set_pos</a></td><td> -
moves the cursor position</td></tr>


<tr><td><a href=#set_visible>set_visible</a></td><td> -
show or hide the mouse cursor</td></tr>


</table>

<hr>

<a name=get_focused><font size=+2><b>get_focused
</b></font><br><font size=+1><tt>
pygame.mouse.get_focused() -> bool
</tt></font><ul>
Returns true when the application is receiving the
mouse input focus.
</ul><br>&nbsp;<br>

<a name=get_pos><font size=+2><b>get_pos
</b></font><br><font size=+1><tt>
pygame.mouse.get_pos() -> x, y
</tt></font><ul>
Returns the current position of the mouse cursor.
This is the absolute mouse position on the screen.
</ul><br>&nbsp;<br>

<a name=get_pressed><font size=+2><b>get_pressed
</b></font><br><font size=+1><tt>
pygame.mouse.get_pressed() -> button1, button2, button3
</tt></font><ul>
This will return a small sequence containing the
pressed state of the mouse buttons.
</ul><br>&nbsp;<br>

<a name=get_rel><font size=+2><b>get_rel
</b></font><br><font size=+1><tt>
pygame.mouse.get_rel() -> x, y
</tt></font><ul>
Returns the total distance the mouse has moved
since your last call to <u>get_rel()</u>. On the first
call to get_rel the movement will always be 0,0.

When the mouse is at the edges of the screen, the
relative movement will be stopped. See
mouse_visible for a way to resolve this.
</ul><br>&nbsp;<br>

<a name=set_pos><font size=+2><b>set_pos
</b></font><br><font size=+1><tt>
pygame.mouse.set_pos(pos) -> None
</tt></font><ul>
Moves the mouse cursor to the specified position.
This will generate a MOUSEMOTION event on the
input queue. The pos argument is a
2-number-sequence containing the desired x and y
position.
</ul><br>&nbsp;<br>

<a name=set_visible><font size=+2><b>set_visible
</b></font><br><font size=+1><tt>
pygame.mouse.set_visible(bool) -> bool
</tt></font><ul>
Shows or hides the mouse cursor. This will return
the previous visible state of the mouse cursor.

Note that when the cursor is hidden and the
application has grabbed the input. pyGame will
force the mouse to stay in the center of the
screen. Since the mouse is hidden it won't matter
that it's not moving, but it will keep the mouse
from the edges of the screen so the relative mouse
position will always be true.
</ul><br>&nbsp;<br>


<hr>

</body></html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.