doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
set_length() Set the number of elements in the Color to 1,2,3, or 4. set_length(len) -> None The default Color length is 4. Colors can have lengths 1,2,3 or 4. This is useful if you want to unpack to r,g,b and not r,g,b,a. If you want to get the length of a Color do len(acolor). New in pygame 1.9.0.
pygame.ref.color#pygame.Color.set_length
update() Sets the elements of the color update(r, g, b) -> None update(r, g, b, a=255) -> None update(color_value) -> None Sets the elements of the color. See parameters for pygame.Color() for the parameters of this function. If the alpha value was not set it will not change. New in pygame 2.0.1.
pygame.ref.color#pygame.Color.update
pygame.cursors pygame module for cursor resources Pygame offers control over the system hardware cursor. Pygame only supports black and white cursors for the system. You control the cursor with functions inside pygame.mouse. This cursors module contains functions for loading and decoding various cursor formats. Th...
pygame.ref.cursors
pygame.cursors.compile() create binary cursor data from simple strings compile(strings, black='X', white='.', xor='o') -> data, mask A sequence of strings can be used to create binary cursor data for the system cursor. This returns the binary data in the form of two tuples. Those can be passed as the third and fourt...
pygame.ref.cursors#pygame.cursors.compile
pygame.cursors.load_xbm() load cursor data from an XBM file load_xbm(cursorfile) -> cursor_args load_xbm(cursorfile, maskfile) -> cursor_args This loads cursors for a simple subset of XBM files. XBM files are traditionally used to store cursors on UNIX systems, they are an ASCII format used to represent simple image...
pygame.ref.cursors#pygame.cursors.load_xbm
pygame.display pygame module to control the display window and screen This module offers control over the pygame display. Pygame has a single display Surface that is either contained in a window or runs full screen. Once you create the display you treat it as a regular Surface. Changes are not immediately visible ...
pygame.ref.display
pygame.display.flip() Update the full display Surface to the screen flip() -> None This will update the contents of the entire display. If your display mode is using the flags pygame.HWSURFACE and pygame.DOUBLEBUF, this will wait for a vertical retrace and swap the surfaces. If you are using a different type of disp...
pygame.ref.display#pygame.display.flip
pygame.display.get_active() Returns True when the display is active on the screen get_active() -> bool Returns True when the display Surface is considered actively renderable on the screen and may be visible to the user. This is the default state immediately after pygame.display.set_mode(). This method may return Tr...
pygame.ref.display#pygame.display.get_active
pygame.display.get_allow_screensaver() Return whether the screensaver is allowed to run. get_allow_screensaver() -> bool Return whether screensaver is allowed to run whilst the app is running. Default is False. By default pygame does not allow the screensaver during game play. Note Some platforms do not have a scre...
pygame.ref.display#pygame.display.get_allow_screensaver
pygame.display.get_caption() Get the current window caption get_caption() -> (title, icontitle) Returns the title and icontitle for the display Surface. These will often be the same value.
pygame.ref.display#pygame.display.get_caption
pygame.display.get_driver() Get the name of the pygame display backend get_driver() -> name Pygame chooses one of many available display backends when it is initialized. This returns the internal name used for the display backend. This can be used to provide limited information about what display capabilities might ...
pygame.ref.display#pygame.display.get_driver
pygame.display.get_init() Returns True if the display module has been initialized get_init() -> bool Returns True if the pygame.display module is currently initialized.
pygame.ref.display#pygame.display.get_init
pygame.display.get_num_displays() Return the number of displays get_num_displays() -> int Returns the number of available displays. This is always 1 if pygame.get_sdl_version() returns a major version number below 2. New in pygame 1.9.5.
pygame.ref.display#pygame.display.get_num_displays
pygame.display.get_surface() Get a reference to the currently set display surface get_surface() -> Surface Return a reference to the currently set display Surface. If no display mode has been set this will return None.
pygame.ref.display#pygame.display.get_surface
pygame.display.get_window_size() Return the size of the window or screen get_window_size() -> tuple Returns the size of the window initialized with pygame.display.set_mode(). This may differ from the size of the display surface if SCALED is used. New in pygame 2.0.0.
pygame.ref.display#pygame.display.get_window_size
pygame.display.get_wm_info() Get information about the current windowing system get_wm_info() -> dict Creates a dictionary filled with string keys. The strings and values are arbitrarily created by the system. Some systems may have no information and an empty dictionary will be returned. Most platforms will return a...
pygame.ref.display#pygame.display.get_wm_info
pygame.display.gl_get_attribute() Get the value for an OpenGL flag for the current display gl_get_attribute(flag) -> value After calling pygame.display.set_mode() with the pygame.OPENGL flag, it is a good idea to check the value of any requested OpenGL attributes. See pygame.display.gl_set_attribute() for a list of ...
pygame.ref.display#pygame.display.gl_get_attribute
pygame.display.gl_set_attribute() Request an OpenGL display attribute for the display mode gl_set_attribute(flag, value) -> None When calling pygame.display.set_mode() with the pygame.OPENGL flag, Pygame automatically handles setting the OpenGL attributes like color and double-buffering. OpenGL offers several other ...
pygame.ref.display#pygame.display.gl_set_attribute
pygame.display.iconify() Iconify the display surface iconify() -> bool Request the window for the display surface be iconified or hidden. Not all systems and displays support an iconified display. The function will return True if successful. When the display is iconified pygame.display.get_active() will return False...
pygame.ref.display#pygame.display.iconify
pygame.display.Info() Create a video display information object Info() -> VideoInfo Creates a simple object containing several attributes to describe the current graphics environment. If this is called before pygame.display.set_mode() some platforms can provide information about the default display mode. This can al...
pygame.ref.display#pygame.display.Info
pygame.display.init() Initialize the display module init() -> None Initializes the pygame display module. The display module cannot do anything until it is initialized. This is usually handled for you automatically when you call the higher level pygame.init(). Pygame will select from one of several internal display ...
pygame.ref.display#pygame.display.init
pygame.display.list_modes() Get list of available fullscreen modes list_modes(depth=0, flags=pygame.FULLSCREEN, display=0) -> list This function returns a list of possible sizes for a specified color depth. The return value will be an empty list if no display modes are available with the given arguments. A return va...
pygame.ref.display#pygame.display.list_modes
pygame.display.mode_ok() Pick the best color depth for a display mode mode_ok(size, flags=0, depth=0, display=0) -> depth This function uses the same arguments as pygame.display.set_mode(). It is used to determine if a requested display mode is available. It will return 0 if the display mode cannot be set. Otherwise...
pygame.ref.display#pygame.display.mode_ok
pygame.display.quit() Uninitialize the display module quit() -> None This will shut down the entire display module. This means any active displays will be closed. This will also be handled automatically when the program exits. It is harmless to call this more than once, repeated calls have no effect.
pygame.ref.display#pygame.display.quit
pygame.display.set_allow_screensaver() Set whether the screensaver may run set_allow_screensaver(bool) -> None Change whether screensavers should be allowed whilst the app is running. The default is False. By default pygame does not allow the screensaver during game play. If the screensaver has been disallowed due t...
pygame.ref.display#pygame.display.set_allow_screensaver
pygame.display.set_caption() Set the current window caption set_caption(title, icontitle=None) -> None If the display has a window title, this function will change the name on the window. Some systems support an alternate shorter title to be used for minimized displays.
pygame.ref.display#pygame.display.set_caption
pygame.display.set_gamma() Change the hardware gamma ramps set_gamma(red, green=None, blue=None) -> bool Set the red, green, and blue gamma values on the display hardware. If the green and blue arguments are not passed, they will both be the same as red. Not all systems and hardware support gamma ramps, if the funct...
pygame.ref.display#pygame.display.set_gamma
pygame.display.set_gamma_ramp() Change the hardware gamma ramps with a custom lookup set_gamma_ramp(red, green, blue) -> bool Set the red, green, and blue gamma ramps with an explicit lookup table. Each argument should be sequence of 256 integers. The integers should range between 0 and 0xffff. Not all systems and h...
pygame.ref.display#pygame.display.set_gamma_ramp
pygame.display.set_icon() Change the system image for the display window set_icon(Surface) -> None Sets the runtime icon the system will use to represent the display window. All windows default to a simple pygame logo for the window icon. You can pass any surface, but most systems want a smaller image around 32x32. ...
pygame.ref.display#pygame.display.set_icon
pygame.display.set_mode() Initialize a window or screen for display set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface This function will create a display Surface. The arguments passed in are requests for a display type. The actual created display will be the best possible match supported by the ...
pygame.ref.display#pygame.display.set_mode
pygame.display.set_palette() Set the display color palette for indexed displays set_palette(palette=None) -> None This will change the video display color palette for 8-bit displays. This does not change the palette for the actual display Surface, only the palette that is used to display the Surface. If no palette a...
pygame.ref.display#pygame.display.set_palette
pygame.display.toggle_fullscreen() Switch between fullscreen and windowed displays toggle_fullscreen() -> int Switches the display window between windowed and fullscreen modes. Display driver support is not great when using pygame 1, but with pygame 2 it is the most reliable method to switch to and from fullscreen. ...
pygame.ref.display#pygame.display.toggle_fullscreen
pygame.display.update() Update portions of the screen for software displays update(rectangle=None) -> None update(rectangle_list) -> None This function is like an optimized version of pygame.display.flip() for software displays. It allows only a portion of the screen to updated, instead of the entire area. If no arg...
pygame.ref.display#pygame.display.update
pygame.draw pygame module for drawing shapes Draw several simple shapes to a surface. These functions will work for rendering to any format of surface. Rendering to hardware surfaces will be slower than regular software surfaces. Most of the functions take a width argument to represent the size of stroke (thicknes...
pygame.ref.draw
pygame.draw.aaline() draw a straight antialiased line aaline(surface, color, start_pos, end_pos) -> Rect aaline(surface, color, start_pos, end_pos, blend=1) -> Rect Draws a straight antialiased line on the given surface. The line has a thickness of one pixel and the endpoints have a height and width of one pixel eac...
pygame.ref.draw#pygame.draw.aaline
pygame.draw.aalines() draw multiple contiguous straight antialiased line segments aalines(surface, color, closed, points) -> Rect aalines(surface, color, closed, points, blend=1) -> Rect Draws a sequence of contiguous straight antialiased lines on the given surface. Parameters: surface (Surface) -- surface t...
pygame.ref.draw#pygame.draw.aalines
pygame.draw.arc() draw an elliptical arc arc(surface, color, rect, start_angle, stop_angle) -> Rect arc(surface, color, rect, start_angle, stop_angle, width=1) -> Rect Draws an elliptical arc on the given surface. The two angle arguments are given in radians and indicate the start and stop positions of the arc. The ...
pygame.ref.draw#pygame.draw.arc
pygame.draw.circle() draw a circle circle(surface, color, center, radius) -> Rect circle(surface, color, center, radius, width=0, draw_top_right=None, draw_top_left=None, draw_bottom_left=None, draw_bottom_right=None) -> Rect Draws a circle on the given surface. Parameters: surface (Surface) -- surface to dr...
pygame.ref.draw#pygame.draw.circle
pygame.draw.ellipse() draw an ellipse ellipse(surface, color, rect) -> Rect ellipse(surface, color, rect, width=0) -> Rect Draws an ellipse on the given surface. Parameters: surface (Surface) -- surface to draw on color (Color or int or tuple(int, int, int, [int])) -- color to draw with, the alpha value is ...
pygame.ref.draw#pygame.draw.ellipse
pygame.draw.line() draw a straight line line(surface, color, start_pos, end_pos, width) -> Rect line(surface, color, start_pos, end_pos, width=1) -> Rect Draws a straight line on the given surface. There are no endcaps. For thick lines the ends are squared off. Parameters: surface (Surface) -- surface to dra...
pygame.ref.draw#pygame.draw.line
pygame.draw.lines() draw multiple contiguous straight line segments lines(surface, color, closed, points) -> Rect lines(surface, color, closed, points, width=1) -> Rect Draws a sequence of contiguous straight lines on the given surface. There are no endcaps or miter joints. For thick lines the ends are squared off. ...
pygame.ref.draw#pygame.draw.lines
pygame.draw.polygon() draw a polygon polygon(surface, color, points) -> Rect polygon(surface, color, points, width=0) -> Rect Draws a polygon on the given surface. Parameters: surface (Surface) -- surface to draw on color (Color or int or tuple(int, int, int, [int])) -- color to draw with, the alpha value i...
pygame.ref.draw#pygame.draw.polygon
pygame.draw.rect() draw a rectangle rect(surface, color, rect) -> Rect rect(surface, color, rect, width=0, border_radius=0, border_top_left_radius=-1, border_top_right_radius=-1, border_bottom_left_radius=-1, border_bottom_right_radius=-1) -> Rect Draws a rectangle on the given surface. Parameters: surface (...
pygame.ref.draw#pygame.draw.rect
pygame.encode_file_path() Encode a Unicode or bytes object as a file system path encode_file_path([obj [, etype]]) -> bytes or None obj: If Unicode, encode; if bytes, return unaltered; if anything else, return None; if not given, raise SyntaxError. etype (exception type): If given, the exception type to raise for an...
pygame.ref.pygame#pygame.encode_file_path
pygame.encode_string() Encode a Unicode or bytes object encode_string([obj [, encoding [, errors [, etype]]]]) -> bytes or None obj: If Unicode, encode; if bytes, return unaltered; if anything else, return None; if not given, raise SyntaxError. encoding (string): If present, encoding to use. The default is 'unicode_...
pygame.ref.pygame#pygame.encode_string
exception pygame.error standard pygame exception raise pygame.error(message) This exception is raised whenever a pygame or SDL operation fails. You can catch any anticipated problems and deal with the error. The exception is always raised with a descriptive message about the problem. Derived from the RuntimeError ex...
pygame.ref.pygame#pygame.error
pygame.event pygame module for interacting with events and queues Pygame handles all its event messaging through an event queue. The routines in this module help you manage that event queue. The input queue is heavily dependent on the pygame.display module. If the display has not been initialized and a video mode ...
pygame.ref.event
pygame.event.clear() remove all events from the queue clear(eventtype=None) -> None clear(eventtype=None, pump=True) -> None Removes all events from the queue. If eventtype is given, removes the given event or sequence of events. This has the same effect as pygame.event.get() except None is returned. It can be sligh...
pygame.ref.event#pygame.event.clear
pygame.event.custom_type() make custom user event type custom_type() -> int Reserves a pygame.USEREVENT for a custom use. If too many events are made a pygame.error is raised. New in pygame 2.0.0.dev3.
pygame.ref.event#pygame.event.custom_type
pygame.event.Event() create a new event object Event(type, dict) -> EventType instance Event(type, **attributes) -> EventType instance Creates a new event with the given type and attributes. The attributes can come from a dictionary argument with string keys or from keyword arguments.
pygame.ref.event#pygame.event.Event
pygame.event.event_name() get the string name from an event id event_name(type) -> string Returns a string representing the name (in CapWords style) of the given event type. "UserEvent" is returned for all values in the user event id range. "Unknown" is returned when the event type does not exist.
pygame.ref.event#pygame.event.event_name
pygame.event.EventType pygame object for representing events A pygame object that represents an event. User event instances are created with an pygame.event.Event() function call. The EventType type is not directly callable. EventType instances support attribute assignment and deletion. type event type identifie...
pygame.ref.event#pygame.event.EventType
__dict__ event attribute dictionary __dict__ -> dict Read-only. The event type specific attributes of an event. The dict attribute is a synonym for backward compatibility. For example, the attributes of a KEYDOWN event would be unicode, key, and mod
pygame.ref.event#pygame.event.EventType.__dict__
type event type identifier. type -> int Read-only. The event type identifier. For user created event objects, this is the type argument passed to pygame.event.Event(). For example, some predefined event identifiers are QUIT and MOUSEMOTION.
pygame.ref.event#pygame.event.EventType.type
pygame.event.get() get events from the queue get(eventtype=None) -> Eventlist get(eventtype=None, pump=True) -> Eventlist This will get all the messages and remove them from the queue. If a type or sequence of types is given only those messages will be removed from the queue. If you are only taking specific events f...
pygame.ref.event#pygame.event.get
pygame.event.get_blocked() test if a type of event is blocked from the queue get_blocked(type) -> bool get_blocked(typelist) -> bool Returns True if the given event type is blocked from the queue. If a sequence of event types is passed, this will return True if any of those event types are blocked.
pygame.ref.event#pygame.event.get_blocked
pygame.event.get_grab() test if the program is sharing input devices get_grab() -> bool Returns True when the input events are grabbed for this application.
pygame.ref.event#pygame.event.get_grab
pygame.event.peek() test if event types are waiting on the queue peek(eventtype=None) -> bool peek(eventtype=None, pump=True) -> bool Returns True if there are any events of the given type waiting on the queue. If a sequence of event types is passed, this will return True if any of those events are on the queue. If ...
pygame.ref.event#pygame.event.peek
pygame.event.poll() get a single event from the queue poll() -> EventType instance Returns a single event from the queue. If the event queue is empty an event of type pygame.NOEVENT will be returned immediately. The returned event is removed from the queue. Caution This function should only be called in the thread ...
pygame.ref.event#pygame.event.poll
pygame.event.post() place a new event on the queue post(Event) -> None Places the given event at the end of the event queue. This is usually used for placing pygame.USEREVENT events on the queue. Although any type of event can be placed, if using the system event types your program should be sure to create the stand...
pygame.ref.event#pygame.event.post
pygame.event.pump() internally process pygame event handlers pump() -> None For each frame of your game, you will need to make some sort of call to the event queue. This ensures your program can internally interact with the rest of the operating system. If you are not using other event functions in your game, you sh...
pygame.ref.event#pygame.event.pump
pygame.event.set_allowed() control which events are allowed on the queue set_allowed(type) -> None set_allowed(typelist) -> None set_allowed(None) -> None The given event types are allowed to appear on the event queue. By default, all event types can be placed on the queue. It is safe to enable an event type multipl...
pygame.ref.event#pygame.event.set_allowed
pygame.event.set_blocked() control which events are allowed on the queue set_blocked(type) -> None set_blocked(typelist) -> None set_blocked(None) -> None The given event types are not allowed to appear on the event queue. By default all events can be placed on the queue. It is safe to disable an event type multiple...
pygame.ref.event#pygame.event.set_blocked
pygame.event.set_grab() control the sharing of input devices with other applications set_grab(bool) -> None When your program runs in a windowed environment, it will share the mouse and keyboard devices with other applications that have focus. If your program sets the event grab to True, it will lock all input into ...
pygame.ref.event#pygame.event.set_grab
pygame.event.wait() wait for a single event from the queue wait() -> EventType instance wait(timeout) -> EventType instance Returns a single event from the queue. If the queue is empty this function will wait until one is created. From pygame 2.0.0, if a timeout argument is given, the function will return an event o...
pygame.ref.event#pygame.event.wait
pygame.examples module of example programs These examples should help get you started with pygame. Here is a brief rundown of what you get. The source code for these examples is in the public domain. Feel free to use for your own projects. There are several ways to run the examples. First they can be run as stand-...
pygame.ref.examples
aliens.main() play the full aliens example aliens.main() -> None This started off as a port of the SDL demonstration, Aliens. Now it has evolved into something sort of resembling fun. This demonstrates a lot of different uses of sprites and optimized blitting. Also transparency, colorkeys, fonts, sound, music, joyst...
pygame.ref.examples#pygame.examples.aliens.main
arraydemo.main() show various surfarray effects arraydemo.main(arraytype=None) -> None Another example filled with various surfarray effects. It requires the surfarray and image modules to be installed. This little demo can also make a good starting point for any of your own tests with surfarray The arraytype parame...
pygame.ref.examples#pygame.examples.arraydemo.main
blend_fill.main() demonstrate the various surface.fill method blend options blend_fill.main() -> None A interactive demo that lets one choose which BLEND_xxx option to apply to a surface.
pygame.ref.examples#pygame.examples.blend_fill.main
blit_blends.main() uses alternative additive fill to that of surface.fill blit_blends.main() -> None Fake additive blending. Using NumPy. it doesn't clamp. Press r,g,b Somewhat like blend_fill.
pygame.ref.examples#pygame.examples.blit_blends.main
camera.main() display video captured live from an attached camera camera.main() -> None A simple live video player, it uses the first available camera it finds on the system.
pygame.ref.examples#pygame.examples.camera.main
chimp.main() hit the moving chimp chimp.main() -> None This simple example is derived from the line-by-line tutorial that comes with pygame. It is based on a 'popular' web banner. Note there are comments here, but for the full explanation, follow along in the tutorial.
pygame.ref.examples#pygame.examples.chimp.main
cursors.main() display two different custom cursors cursors.main() -> None Display an arrow or circle with crossbar cursor.
pygame.ref.examples#pygame.examples.cursors.main
eventlist.main() display pygame events eventlist.main() -> None Eventlist is a sloppy style of pygame, but is a handy tool for learning about pygame events and input. At the top of the screen are the state of several device values, and a scrolling list of events are displayed on the bottom. This is not quality 'ui' ...
pygame.ref.examples#pygame.examples.eventlist.main
fastevents.main() stress test the fastevents module fastevents.main() -> None This is a stress test for the fastevents module. Fast events does not appear faster! So far it looks like normal pygame.event is faster by up to two times. So maybe fastevent isn't fast at all. Tested on Windows XP SP2 Athlon, and F...
pygame.ref.examples#pygame.examples.fastevents.main
fonty.main() run a font rendering example fonty.main() -> None Super quick, super simple application demonstrating the different ways to render fonts with the font module
pygame.ref.examples#pygame.examples.fonty.main
freetype_misc.main() run a FreeType rendering example freetype_misc.main() -> None A showcase of rendering features the pygame.freetype.Font class provides in addition to those available with pygame.font.Font. It is a demonstration of direct to surface rendering, with vertical text and rotated text, opaque text and ...
pygame.ref.examples#pygame.examples.freetype_misc.main
glcube.main() display an animated 3D cube using OpenGL glcube.main() -> None Using PyOpenGL and pygame, this creates a spinning 3D multicolored cube.
pygame.ref.examples#pygame.examples.glcube.main
headless_no_windows_needed.main() write an image file that is smoothscaled copy of an input file headless_no_windows_needed.main(fin, fout, w, h) -> None arguments: fin - name of an input image file fout - name of the output file to create/overwrite w, h - size of the rescaled image, as integer width and height How ...
pygame.ref.examples#pygame.examples.headless_no_windows_needed.main
liquid.main() display an animated liquid effect liquid.main() -> None This example was created in a quick comparison with the BlitzBasic gaming language. Nonetheless, it demonstrates a quick 8-bit setup (with colormap).
pygame.ref.examples#pygame.examples.liquid.main
mask.main() display multiple images bounce off each other using collision detection mask.main(*args) -> None Positional arguments: one or more image file names. This pygame.masks demo will display multiple moving sprites bouncing off each other. More than one sprite image can be provided. If run as a program then ma...
pygame.ref.examples#pygame.examples.mask.main
midi.main() run a midi example midi.main(mode='output', device_id=None) -> None Arguments: mode - if 'output' run a midi keyboard output example 'input' run a midi event logger input example 'list' list available midi devices (default 'output') device_id - midi device number; if None then ...
pygame.ref.examples#pygame.examples.midi.main
moveit.main() display animated objects on the screen moveit.main() -> None This is the full and final example from the Pygame Tutorial, "How Do I Make It Move". It creates 10 objects and animates them on the screen. Note it's a bit scant on error checking, but it's easy to read. :] Fortunately, this is python, and w...
pygame.ref.examples#pygame.examples.moveit.main
oldalien.main() play the original aliens example oldalien.main() -> None This more closely resembles a port of the SDL Aliens demo. The code is a lot simpler, so it makes a better starting point for people looking at code for the first times. These blitting routines are not as optimized as they should/could be, but ...
pygame.ref.examples#pygame.examples.oldalien.main
overlay.main() play a .pgm video using overlays overlay.main(fname) -> None Play the .pgm video file given by a path fname. If run as a program overlay.py takes the file name as a command line argument.
pygame.ref.examples#pygame.examples.overlay.main
pixelarray.main() display various pixelarray generated effects pixelarray.main() -> None Display various pixelarray generated effects.
pygame.ref.examples#pygame.examples.pixelarray.main
playmus.main() play an audio file playmus.main(file_path) -> None A simple music player with window and keyboard playback control. Playback can be paused and rewound to the beginning.
pygame.ref.examples#pygame.examples.playmus.main
scaletest.main() interactively scale an image using smoothscale scaletest.main(imagefile, convert_alpha=False, run_speed_test=True) -> None arguments: imagefile - file name of source image (required) convert_alpha - use convert_alpha() on the surf (default False) run_speed_test - (default False) A smoothscale exampl...
pygame.ref.examples#pygame.examples.scaletest.main
scrap_clipboard.main() access the clipboard scrap_clipboard.main() -> None A simple demonstration example for the clipboard support.
pygame.ref.examples#pygame.examples.scrap_clipboard.main
scroll.main() run a Surface.scroll example that shows a magnified image scroll.main(image_file=None) -> None This example shows a scrollable image that has a zoom factor of eight. It uses the Surface.scroll() function to shift the image on the display surface. A clip rectangle protects a margin area. If called as a ...
pygame.ref.examples#pygame.examples.scroll.main
sound.main() load and play a sound sound.main(file_path=None) -> None Extremely basic testing of the mixer module. Load a sound and play it. All from the command shell, no graphics. If provided, use the audio file 'file_path', otherwise use a default file. sound.py optional command line argument: an audio file
pygame.ref.examples#pygame.examples.sound.main
sound_array_demos.main() play various sndarray effects sound_array_demos.main(arraytype=None) -> None Uses sndarray and NumPy to create offset faded copies of the original sound. Currently it just uses hardcoded values for the number of echoes and the delay. Easy for you to recreate as needed. The arraytype paramete...
pygame.ref.examples#pygame.examples.sound_array_demos.main
stars.main() run a simple starfield example stars.main() -> None A simple starfield example. You can change the center of perspective by leftclicking the mouse on the screen.
pygame.ref.examples#pygame.examples.stars.main
testsprite.main() show lots of sprites moving around testsprite.main(update_rects = True, use_static = False, use_FastRenderGroup = False, screen_dims = [640, 480], use_alpha = False, flags = 0) -> None Optional keyword arguments: update_rects - use the RenderUpdate sprite group class use_static - include non-moving...
pygame.ref.examples#pygame.examples.testsprite.main
vgrade.main() display a vertical gradient vgrade.main() -> None Demonstrates creating a vertical gradient with pixelcopy and NumPy python. The app will create a new gradient every half second and report the time needed to create and display the image. If you're not prepared to start working with the NumPy arrays, do...
pygame.ref.examples#pygame.examples.vgrade.main
pygame.fastevent pygame module for interacting with events and queues pygame.fastevent is a wrapper for Bob Pendleton's fastevent library. It provides fast events for use in multithreaded environments. When using pygame.fastevent, you can not use any of the pump, wait, poll, post, get, peek, etc. functions from py...
pygame.ref.fastevent
pygame.fastevent.get() get all events from the queue get() -> list of Events This will get all the messages and remove them from the queue.
pygame.ref.fastevent#pygame.fastevent.get
pygame.fastevent.get_init() returns True if the fastevent module is currently initialized get_init() -> bool Returns True if the pygame.fastevent module is currently initialized.
pygame.ref.fastevent#pygame.fastevent.get_init
pygame.fastevent.init() initialize pygame.fastevent init() -> None Initialize the pygame.fastevent module.
pygame.ref.fastevent#pygame.fastevent.init
pygame.fastevent.poll() get an available event poll() -> Event Returns next event on queue. If there is no event waiting on the queue, this will return an event with type NOEVENT.
pygame.ref.fastevent#pygame.fastevent.poll