Source

pygame / docs / pygame_event.html

Full commit
<html>
<title>pygame.event</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.event</h2>
Contains event routines and object.

<hr>

<table>
<tr><td><a href=#event>event</a></td><td> -
create new event object</td></tr>


<tr><td><a href=#event_name>event_name</a></td><td> -
name for event type</td></tr>


<tr><td><a href=#get>get</a></td><td> -
get all of an event type from the queue</td></tr>


<tr><td><a href=#peek>peek</a></td><td> -
query if any of event types are waiting</td></tr>


<tr><td><a href=#poll>poll</a></td><td> -
get an available event</td></tr>


<tr><td><a href=#post>post</a></td><td> -
place an event on the queue</td></tr>


<tr><td><a href=#pump>pump</a></td><td> -
update the internal messages</td></tr>


<tr><td><a href=#set_allowed>set_allowed</a></td><td> -
allows certain events onto the queue</td></tr>


<tr><td><a href=#set_blocked>set_blocked</a></td><td> -
blocks certain events from the queue</td></tr>


<tr><td><a href=#set_grab>set_grab</a></td><td> -
grab all input events</td></tr>


<tr><td><a href=#wait>wait</a></td><td> -
wait for an event</td></tr>


</table>

<hr>

<a name=event><font size=+2><b>event
</b></font><br><font size=+1><tt>
pygame.event.event(type, dict) -> Event
</tt></font><ul>
Creates a new event object. The type should be one
of SDL's event numbers, or above USER_EVENT. The
given dictionary contains a list of readonly
attributes that will be members of the event
object.
</ul><br>&nbsp;<br>

<a name=event_name><font size=+2><b>event_name
</b></font><br><font size=+1><tt>
pygame.event.event_name(event type) -> string
</tt></font><ul>
Returns the standard SDL name for an event type.
Mainly helpful for debugging, when trying to
determine what the type of an event is.
</ul><br>&nbsp;<br>

<a name=get><font size=+2><b>get
</b></font><br><font size=+1><tt>
pygame.event.get([type]) -> list of Events
</tt></font><ul>
Pass this a type of event that you are interested
in, and it will return a list of all matching
event types from the queue. If no types are
passed, this will return all the events from the
queue. You may also optionally pass a sequence of
event types. For example, to fetch all the
keyboard events from the queue, you would call,
'pygame.event.get([KEYDOWN,KEYUP])'.
</ul><br>&nbsp;<br>

<a name=peek><font size=+2><b>peek
</b></font><br><font size=+1><tt>
pygame.event.peek([type]) -> bool
</tt></font><ul>
Pass this a type of event that you are interested
in, and it will return true if there are any of
that type of event on the queue. If no types are
passed, this will return true if any events are on
the queue. You may also optionally pass a sequence
of event types. For example, to find if any
keyboard events are on the queue, you would call,
'pygame.event.peek([KEYDOWN,KEYUP])'.
</ul><br>&nbsp;<br>

<a name=poll><font size=+2><b>poll
</b></font><br><font size=+1><tt>
pygame.event.poll() -> Event
</tt></font><ul>
Returns next event on queue. If there is no event
waiting on the queue, this will return an event with
 type NOEVENT.
</ul><br>&nbsp;<br>

<a name=post><font size=+2><b>post
</b></font><br><font size=+1><tt>
pygame.event.post(Event) -> None
</tt></font><ul>
This will place an event onto the queue. This is
most useful for putting your own USEREVENT's onto
the queue.
</ul><br>&nbsp;<br>

<a name=pump><font size=+2><b>pump
</b></font><br><font size=+1><tt>
pygame.event.pump() -> None
</tt></font><ul>
Pumping the message queue is important if you are
not getting events off the message queue. The pump
will allow pyGame to communicate with the window
manager, which helps keep your application
responsive, as well as updating the state for
various input devices.
</ul><br>&nbsp;<br>

<a name=set_allowed><font size=+2><b>set_allowed
</b></font><br><font size=+1><tt>
pygame.event.set_allowed(type) -> None
</tt></font><ul>
By default, all events will appear from the queue.
After you have blocked some event types, you can
use this to re-enable them. You can optionally
pass a sequence of event types.
</ul><br>&nbsp;<br>

<a name=set_blocked><font size=+2><b>set_blocked
</b></font><br><font size=+1><tt>
pygame.event.set_blocked(type) -> None
</tt></font><ul>
By default, all events will appear from the queue.
This will allow you to prevent event types from
appearing on the queue. You can optionally pass a
sequence of event types.
</ul><br>&nbsp;<br>

<a name=set_grab><font size=+2><b>set_grab
</b></font><br><font size=+1><tt>
pygame.event.set_grab(bool) -> None
</tt></font><ul>
Grabs all mouse and keyboard input for the
display. Grabbing the input is not neccessary to
receive keyboard and mouse events, but it ensures
all input will go to your application. It also
keeps the mouse locked inside your window. Set the
grabbing on or off with the boolean argument. It
is best to not always grab the input, since it
prevents the end user from doing anything else on
their system.
</ul><br>&nbsp;<br>

<a name=wait><font size=+2><b>wait
</b></font><br><font size=+1><tt>
pygame.event.wait() -> Event
</tt></font><ul>
Returns the current event on the queue. If there
are no messages waiting on the queue, this will
not return until one is available. Sometimes it is
important to use this wait to get events from the
queue, it will allow your application to idle when
the user isn't doing anything with it.
</ul><br>&nbsp;<br>


<hr>

</body></html>