pygame documentation | || Home || Help Contents || || pygame || cdrom || constants || cursor || display || draw || || event || font || image || joystick || key || mixer || || mixer_music || mouse || movie || sndarray || surfarray || time || || transform || || CD || Channel || Clock || Font || Joystick || Movie || || Overlay || Rect || Sound || Surface || || color || cursors || sprite ||

## Pygame Documentation

The pygame documentation is mainly generated automatically from the source code. Each module and object in the package is broken into its own page in the reference documentation. The names of the objects are capitalized, while the regular module names are lower case.
The pygame documentation also comes with a full set of tutorials. You can find links to these tutorials and other documentation files below.

Tutorials
- DisplayModes - Choosing and Configuring Display Modes
- Executable - Creating a Standalone Windows Executable
- ImportInit - Import and Initialize
- MoveIt - Help! How Do I Move An Image?
- SpriteIntro - Sprite Module Introduction
- ChimpLineByLine - Line by Line Descriptions of the Chimp Example
- Intro - Pygame Python Introduction
- Newbieguide - David Clark's Newbie Guide To Pygame
- SurfarrayIntro - Introduction to the surfarray module
- MakeGames - Tom Chance's Making Games Tutorial
Included With Pygame
- Readme - Pygame Readme Information
- Install - Install Information
- LGPL - Gnu lesser general public license
- Logos - Pygame Logos

Full Index

CD.eject - ejects cdrom drive
CD.get_all - get all track information for the cd
CD.get_busy - checks if the cd is currently playing
CD.get_current - get current position of the cdrom
CD.get_empty - checks for a cd in the drive
CD.get_id - get device id number for drive
CD.get_init - check if cd is initialized
CD.get_name - query name of cdrom drive
CD.get_numtracks - get number of tracks on cd
CD.get_paused - checks if the cd is currently paused
CD.get_track_audio - check if a track has audio data
CD.get_track_length - check the length of an audio track
CD.get_track_start - check the start of an audio track
CD.init - initialize a cdrom device for use
CD.pause - pause playing cdrom
CD.play - play music from cdrom
CD.quit - uninitialize a cdrom device for use
CD.resume - resume paused cdrom
CD.stop - stops playing cdrom
Channel.fadeout - fade out the channel
Channel.get_busy - query state of the channel
Channel.get_endevent - get the endevent for a channel
Channel.get_queue - get the currently queued sound object
Channel.get_sound - get the currently playing sound object
Channel.get_volume - query the volume for the
Channel.pause - temporarily stop the channel
Channel.play - play a sound on this channel
Channel.queue - queue a sound on this channel
Channel.set_endevent - set an endevent for a channel
Channel.set_volume - set volume for channel
Channel.stop - stop playing on the channel
Channel.unpause - restart a paused channel
Clock.get_fps - get the current rate of frames per second
Clock.get_rawtime - get number of nondelayed milliseconds between last two calls to tick()
Clock.get_time - get number of milliseconds between last two calls to tick()
Clock.tick - control timer events
Font.get_ascent - gets the font ascent
Font.get_bold - status of the bold attribute
Font.get_descent - gets the font descent
Font.get_height - average height of font glyph
Font.get_italic - status of the italic attribute
Font.get_linesize - gets the font recommended linesize
Font.get_underline - status of the underline attribute
Font.render - render text to a new image
Font.set_bold - assign the bold attribute
Font.set_italic - assign the italic attribute
Font.set_underline - assign the underline attribute
Font.size - size of rendered text
Joystick.get_axis - get the position of a joystick axis
Joystick.get_ball - get the movement of a joystick trackball
Joystick.get_button - get the position of a joystick button
Joystick.get_hat - get the position of a joystick hat
Joystick.get_id - get device id number for joystick
Joystick.get_init - check if joystick is initialized
Joystick.get_name - query name of joystick drive
Joystick.get_numaxes - get number of axes on a joystick
Joystick.get_numballs - get number of trackballs on a joystick
Joystick.get_numbuttons - get number of buttons on a joystick
Joystick.get_numhats - get number of hats on a joystick
Joystick.init - initialize a joystick device for use
Joystick.quit - uninitialize a joystick device for use
Movie.get_busy - query the playback state
Movie.get_busy - query the playback state
Movie.get_frame - query the current frame in the movie
Movie.get_frame - query the current frame in the movie
Movie.get_length - query playback time of the movie
Movie.get_length - query playback time of the movie
Movie.get_size - query the size of the video image
Movie.get_size - query the size of the video image
Movie.get_time - query the current time in the movie
Movie.get_time - query the current time in the movie
Movie.has_audio - query if movie stream has audio
Movie.has_audio - query if movie stream has audio
Movie.has_video - query if movie stream has video
Movie.has_video - query if movie stream has video
Movie.pause - pause/resume movie playback
Movie.pause - pause/resume movie playback
Movie.play - start movie playback
Movie.play - start movie playback
Movie.render_frame - Render a specfic numbered frame.
Movie.rewind - set playback position to the beginning of the movie
Movie.rewind - set playback position to the beginning of the movie
Movie.set_display - change the video output surface
Movie.set_display - change the video output surface
Movie.set_volume - change volume for sound
Movie.set_volume - change volume for sound
Movie.skip - skip ahead a given amount of time
Movie.skip - skip the movie playback position forward
Movie.stop - stop movie playback
Movie.stop - stop movie playback
Overlay.display - display the yuv data
Overlay.set_location - set overlay location
Rect.clamp - move rectangle inside another
Rect.clamp_ip - moves the rectangle inside another
Rect.clip - rectangle cropped inside another
Rect.collidedict - find overlapping rectangle in a dictionary
Rect.collidedictall - find all overlapping rectangles
Rect.collidelist - find overlapping rectangle
Rect.collidelistall - find all overlapping rectangles
Rect.collidepoint - point inside rectangle
Rect.colliderect - check overlapping rectangles
Rect.contains - check if rectangle fully inside another
Rect.fit - Fill as much of the argument as possible, maintains aspect ratio
Rect.inflate - new rectangle with size changed
Rect.inflate_ip - changes the Rect size
Rect.move - new rectangle with position changed
Rect.move_ip - move the Rect by the given offset
Rect.normalize - corrects negative sizes
Rect.union - makes new rectangle covering both inputs
Rect.union_ip - rectangle covering both input
Rect.unionall - rectangle covering all inputs
Rect.unionall_ip - rectangle covering all inputs
Sound.fadeout - fadeout all channels playing this sound
Sound.get_length - get the length of the Sound in seconds.
Sound.get_num_channels - number of channels with sound
Sound.get_volume - query volume for sound
Sound.play - play sound
Sound.set_volume - change volume for sound
Sound.stop - stop all channels playing this sound
Surface.blit - copy a one Surface to another.
Surface.convert - new copy of surface with different format
Surface.convert_alpha - new copy of surface with different format and per pixel alpha
Surface.copy - creates a new copy of a Surface
Surface.fill - fill areas of a Surface
Surface.get_abs_offset - get absolute offset of subsurface
Surface.get_abs_parent - get the toplevel surface for a subsurface
Surface.get_alpha - query alpha information
Surface.get_at - get a pixel color
Surface.get_bitsize - query size of pixel
Surface.get_bytesize - query size of pixel
Surface.get_clip - query the clipping area
Surface.get_colorkey - query colorkey
Surface.get_flags - query the surface flags
Surface.get_height - query the surface height
Surface.get_locked - check if the surface needs locking
Surface.get_losses - get mapping losses for each colorplane
Surface.get_masks - get mapping bitmasks for each colorplane
Surface.get_offset - get offset of subsurface
Surface.get_palette - get the palette
Surface.get_palette_at - get a palette entry
Surface.get_parent - get a subsurface parent
Surface.get_pitch - query the surface pitch
Surface.get_rect - get a rectangle covering the entire surface
Surface.get_shifts - alphashift
Surface.get_size - query the surface size
Surface.get_width - query the surface width
Surface.lock - locks Surface for pixel access
Surface.map_rgb - convert RGB into a mapped color
Surface.mustlock - check if the surface needs locking
Surface.set_alpha - change alpha information
Surface.set_at - set pixel at given position
Surface.set_clip - assign destination clipping rectangle
Surface.set_colorkey - change colorkey information
Surface.set_palette - set the palette
Surface.set_palette_at - set a palette entry
Surface.subsurface - create a new surface that shares pixel data
Surface.unlock - locks Surface for pixel access
Surface.unmap_rgb - convert mapped color into RGB
pygame.Overlay - Create a new video overlay object
pygame.Rect - create a new rectangle
pygame.Surface - create a new Surface
pygame.get_error - get current error message
pygame.get_sdl_version - get the version of the linked SDL runtime
pygame.init - autoinitialize all imported pygame modules
pygame.quit - uninitialize all pygame modules
pygame.register_quit - routine to call when pygame quits
cdrom.CD - create new CD object
cdrom.get_count - query number of cdroms on system
cdrom.get_init - query init of cdrom module
cdrom.init - initialize the cdrom subsystem
cdrom.quit - uninitialize the cdrom subsystem
color.Color - Get RGB values from common color names
color.add - add two colors
color.multiply - multiply two colors
color.subtract - subtract two colors
constants.display - The following constants are used by the display module and Surfaces
constants.events - These constants define the various event types
constants.keyboard - These constants represent the keys on the keyboard.
constants.modifiers - These constants represent the modifier keys on the keyboard.
constants.time - These constants define the various time constants
cursor.compile - compile cursor strings into cursor data
cursors.load_xbm - reads a pair of XBM files into set_cursor arguments
display.Info - get display capabilities and settings
display.flip - update the display
display.get_active - get state of display mode
display.get_caption - get the current title of the window
display.get_driver - get the current sdl video driver
display.get_init - get status of display module initialization
display.get_surface - get current display surface
display.get_wm_info - get settings from the system window manager
display.gl_get_attribute - get special OPENGL attributes
display.gl_set_attribute - set special OPENGL attributes
display.iconify - minimize the display window
display.init - initialize the display module
display.list_modes - query all resolutions for requested mode
display.mode_ok - query a specific display mode
display.quit - uninitialize the display module
display.set_caption - changes the title of the window
display.set_gamma - change the brightness of the display
display.set_gamma_ramp - advanced control over the display gamma ramps
display.set_icon - changes the window manager icon for the window
display.set_mode - set the display mode
display.set_palette - set the palette
display.toggle_fullscreen - switch the display fullscreen mode
display.update - update an area of the display
draw.aaline - draw a line on a surface
draw.aalines - draw multiple connected anti-aliased lines on a surface
draw.arc - draw an elliptic arc on a surface
draw.circle - draw a circle on a surface
draw.ellipse - draw an ellipse on a surface
draw.line - draw a line on a surface
draw.lines - draw multiple connected lines on a surface
draw.polygon - draws a polygon on a surface
draw.rect - draws a rectangle on a surface
event.Event - create new event object
event.clear - remove all of an event type from the queue
event.event_name - name for event type
event.get - get all of an event type from the queue
event.get_blocked - checks if an event is being blocked
event.get_grab - query the state of input grabbing
event.peek - query if any of event types are waiting
event.poll - get an available event
event.post - place an event on the queue
event.pump - update the internal messages
event.set_allowed - allows certain events onto the queue
event.set_blocked - blocks certain events from the queue
event.set_grab - grab all input events
event.wait - wait for an event
font.Font - create a new font object
font.SysFont - create a pygame Font from system font resources
font.get_default_font - get the name of the default font
font.get_fonts - get a list of system font names
font.get_init - get status of font module initialization
font.init - initialize the display module
font.match_font - find the filename for the named system font
font.quit - uninitialize the font module
image.frombuffer - create a surface from a python memory buffer
image.fromstring - create a surface from a raw string buffer
image.get_extended - returns true if SDL_image formats are available
image.load - load an image to a new Surface
image.save - save surface data
image.tostring - create a raw string buffer of the surface data
joystick.Joystick - create new joystick object
joystick.get_count - query number of joysticks on system
joystick.get_init - query initialization of joystick module
joystick.init - initialize joystick module
joystick.quit - uninitialize joystick module
key.get_focused - state of keyboard focus
key.get_mods - get current state of modifier keys
key.get_pressed - get the pressed state for all keys
key.name - get the name of a key
key.set_mods - set the state of the modifier keys
key.set_repeat - change the keyboard repeat
mixer.Channel - get channel object
mixer.Sound - load a new soundfile
mixer.fadeout - fadeout all channels
mixer.find_channel - find an available sound channel
mixer.get_busy - query busy channels
mixer.get_init - query initialization for the mixer
mixer.get_num_channels - query the number of channels
mixer.init - initialize mixer module
mixer.pause - pause all channels
mixer.pre_init - presets the init default values
mixer.quit - unitializes the mixer
mixer.set_num_channels - sets the number of available channels
mixer.set_reserved - reserves first given channels
mixer.stop - stop all channels
mixer.unpause - restart any pause channels
mixer.music.fadeout - fadeout current music
mixer.music.get_busy - query state of the music
mixer.music.get_endevent - query the current music finished event
mixer.music.get_pos - query music position
mixer.music.get_volume - query music volume
mixer.music.load - load current music
mixer.music.pause - pause the playing music
mixer.music.play - play the current loaded music
mixer.music.queue - preload and queue a music file
mixer.music.rewind - restarts music
mixer.music.set_endevent - sets music finished event
mixer.music.set_volume - set music volume
mixer.music.stop - stop the playing music
mixer.music.unpause - restarts the paused music
mouse.get_cursor - get mouse cursor data
mouse.get_focused - state of mouse input focus
mouse.get_pos - gets the cursor position
mouse.get_pressed - state of the mouse buttons
mouse.get_rel - gets the movement of the mouse
mouse.set_cursor - state of shape of the mouse cursor
mouse.set_pos - moves the cursor position
mouse.set_visible - show or hide the mouse cursor
movie.Movie - load a new MPEG stream
movie.Movie - load a new MPEG stream
sndarray.array - get an array copied from a sound
sndarray.make_sound - create a new Sound object from array data
sndarray.samples - get a reference to the sound samples
sprite.AbstractGroup.add - add sprite to group
sprite.AbstractGroup.clear - erase the previous position of all sprites
sprite.AbstractGroup.copy - copy a group with all the same sprites
sprite.AbstractGroup.draw - draw all sprites onto the surface
sprite.AbstractGroup.empty - remove all sprites
sprite.AbstractGroup.has - ask if group has a sprite or sprites
sprite.AbstractGroup.remove - remove sprite from group
sprite.AbstractGroup.sprites - get a list of sprites in the group
sprite.AbstractGroup.update - call update for all member sprites
sprite.AbstractGroup - (class) - A base for containers for sprites. It does everything
sprite.Group - (class) - The basic Group class you will want to use.
sprite.GroupSingle - (class) - A group container that holds a single most recent item.
sprite.OrderedUpdates - (class) - RenderUpdates, but the sprites are drawn in the order they were added.
sprite.RenderClear - (class) - The basic Group class you will want to use.
sprite.RenderPlain - (class) - The basic Group class you will want to use.
sprite.RenderUpdates - (class) - A sprite group that's more efficient at updating.
sprite.Sprite.add - add a sprite to container
sprite.Sprite.alive - check to see if the sprite is in any groups
sprite.Sprite.groups - list used sprite containers
sprite.Sprite.kill - remove this sprite from all groups
sprite.Sprite.remove - remove a sprite from container
sprite.Sprite - (class) - The base class for your visible game objects.
sprite.groupcollide - collision detection between group and group
sprite.spritecollide - collision detection between sprite and group
sprite.spritecollideany - finds any sprites that collide
surfarray.array2d - get a 2d array copied from a surface
surfarray.array3d - get a 3d array copied from a surface
surfarray.array_alpha - get an array with a surface pixel alpha values
surfarray.array_colorkey - get an array with a surface colorkey values
surfarray.blit_array - quickly transfer an array to a Surface
surfarray.make_surface - create a new Surface from array data
surfarray.map_array - map an array with RGB values into mapped colors
surfarray.pixels2d - get a 2d reference array to a surface
surfarray.pixels3d - get a 3d reference array to a surface
surfarray.pixels_alpha - get a reference array to a surface alpha data
time.Clock - create a new clock
time.delay - accurately delay for a number of milliseconds
time.get_ticks - milliseconds since initialization
time.set_timer - control timer events
time.wait - yielding delay for a number of milliseconds
transform.chop - remove a region of an surface
transform.flip - flips a surface on either axis
transform.rotate - rotate a Surface
transform.rotozoom - smoothly scale and/or rotate an image
transform.scale2x - doubles the size of the image with advanced scaling
transform.scale - scale a Surface to an arbitrary size