neulab/docprompting-conala huggingface dataset:
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.
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.
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.
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.
cursors.main() 
 display two different custom cursors cursors.main() -> None  Display an arrow or circle with crossbar cursor.
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' code at all, but you can see how to implement very non-interactive status displays, or even a crude text output control.
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 FreeBSD. However... on my Debian Duron 850 machine fastevents is faster.
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
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 semi transparent text, horizontally stretched text and vertically stretched text.
glcube.main() 
 display an animated 3D cube using OpenGL glcube.main() -> None  Using PyOpenGL and pygame, this creates a spinning 3D multicolored cube.
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 to use pygame with no windowing system, like on headless servers. Thumbnail generation with scaling is an example of what you can do with pygame. NOTE: the pygame scale function uses MMX/SSE if available, and can be run in multiple threads. If headless_no_windows_needed.py is run as a program it takes the following command line arguments: -scale inputimage outputimage new_width new_height
eg. -scale in.png outpng 50 50
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).
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 mask.py takes one or more image files as command line arguments.
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 use the default midi input or
            output device for the system The output example shows how to translate mouse clicks or computer keyboard events into midi notes. It implements a rudimentary button widget and state machine. The input example shows how to translate midi input to pygame events. With the use of a virtual midi patch cord the output and input examples can be run as separate processes and connected so the keyboard output is displayed on a console. new to pygame 1.9.0
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 we needn't wrestle with a pile of error codes.
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 the code is easier to follow, and it plays quick enough.
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.
pixelarray.main() 
 display various pixelarray generated effects pixelarray.main() -> None  Display various pixelarray generated effects.
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.
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 example that resized an image on the screen. Vertical and horizontal arrow keys are used to change the width and height of the displayed image. If the convert_alpha option is True then the source image is forced to have source alpha, whether or not the original images does. If run_speed_test is True then a background timing test is performed instead of the interactive scaler. If scaletest.py is run as a program then the command line options are: ImageFile [-t] [-convert_alpha]
[-t] = Run Speed Test
[-convert_alpha] = Use convert_alpha() on the surf.
scrap_clipboard.main() 
 access the clipboard scrap_clipboard.main() -> None  A simple demonstration example for the clipboard support.
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 function, the example accepts an optional image file path. If run as a program it takes an optional file path command line argument. If no file is provided a default image file is used. When running click on a black triangle to move one pixel in the direction the triangle points. Or use the arrow keys. Close the window or press ESC to quit.
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
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 parameter is deprecated; passing any value besides 'numpy' will raise ValueError.
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.
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 images
use_FastRenderGroup - Use the FastRenderGroup sprite group
screen_dims - pygame window dimensions
use_alpha - use alpha blending
flags - additional display mode flags Like the testsprite.c that comes with SDL, this pygame version shows lots of sprites moving around. If run as a stand-alone program then no command line arguments are taken.
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, don't worry about the source for this one :]
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 pygame.event, but you should use the Event objects.   pygame.fastevent.init() 
 initialize pygame.fastevent init() -> None  Initialize the pygame.fastevent module. 
   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.fastevent.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. This function is not necessary if your program is consistently processing events on the queue through the other pygame.fastevent functions. There are important things that must be dealt with internally in the event queue. The main window may need to be repainted or respond to the system. If you fail to make a call to the event queue for too long, the system may decide your program has locked up. 
   pygame.fastevent.wait() 
 wait for an event wait() -> Event  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. 
   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.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.fastevent.post() 
 place an event on the queue post(Event) -> None  This will post your own event objects onto the event queue. You can post any event type you want, but some care must be taken. For example, if you post a MOUSEBUTTONDOWN event to the queue, it is likely any code receiving the event will expect the standard MOUSEBUTTONDOWN attributes to be available, like 'pos' and 'button'. Because pygame.fastevent.post() may have to wait for the queue to empty, you can get into a dead lock if you try to append an event on to a full queue from the thread that processes events. For that reason I do not recommend using this function in the main thread of an SDL program.
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.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.fastevent.init() 
 initialize pygame.fastevent init() -> None  Initialize the pygame.fastevent module.
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.fastevent.post() 
 place an event on the queue post(Event) -> None  This will post your own event objects onto the event queue. You can post any event type you want, but some care must be taken. For example, if you post a MOUSEBUTTONDOWN event to the queue, it is likely any code receiving the event will expect the standard MOUSEBUTTONDOWN attributes to be available, like 'pos' and 'button'. Because pygame.fastevent.post() may have to wait for the queue to empty, you can get into a dead lock if you try to append an event on to a full queue from the thread that processes events. For that reason I do not recommend using this function in the main thread of an SDL program.
pygame.fastevent.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. This function is not necessary if your program is consistently processing events on the queue through the other pygame.fastevent functions. There are important things that must be dealt with internally in the event queue. The main window may need to be repainted or respond to the system. If you fail to make a call to the event queue for too long, the system may decide your program has locked up.
pygame.fastevent.wait() 
 wait for an event wait() -> Event  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.
bold 
 Gets or sets whether the font should be rendered in (faked) bold. bold -> bool  Whether the font should be rendered in bold. When set to True, this enables the bold rendering of text. This is a fake stretching of the font that doesn't look good on many font types. If possible load the font from a real bold font file. While bold, the font will have a different width than when normal. This can be mixed with the italic and underline modes.  New in pygame 2.0.0.
get_ascent() 
 get the ascent of the font get_ascent() -> int  Return the height in pixels for the font ascent. The ascent is the number of pixels from the font baseline to the top of the font.
get_bold() 
 check if text will be rendered bold get_bold() -> bool  Return True when the font bold rendering mode is enabled.  Note This is the same as the bold attribute.
get_descent() 
 get the descent of the font get_descent() -> int  Return the height in pixels for the font descent. The descent is the number of pixels from the font baseline to the bottom of the font.
get_height() 
 get the height of the font get_height() -> int  Return the height in pixels of the actual rendered text. This is the average size for each glyph in the font.
get_italic() 
 check if the text will be rendered italic get_italic() -> bool  Return True when the font italic rendering mode is enabled.  Note This is the same as the italic attribute.
get_linesize() 
 get the line space of the font text get_linesize() -> int  Return the height in pixels for a line of text with the font. When rendering multiple lines of text this is the recommended amount of space between lines.
get_underline() 
 check if text will be rendered with an underline get_underline() -> bool  Return True when the font underline is enabled.  
 Note This is the same as the underline attribute.
italic 
 Gets or sets whether the font should be rendered in (faked) italics. italic -> bool  Whether the font should be rendered in italic. When set to True, this enables fake rendering of italic text. This is a fake skewing of the font that doesn't look good on many font types. If possible load the font from a real italic font file. While italic the font will have a different width than when normal. This can be mixed with the bold and underline modes.  New in pygame 2.0.0.
metrics() 
 gets the metrics for each character in the passed string metrics(text) -> list  The list contains tuples for each character, which contain the minimum X offset, the maximum X offset, the minimum Y offset, the maximum Y offset and the advance offset (bearing plus width) of the character. [(minx, maxx, miny, maxy, advance), (minx, maxx, miny, maxy, advance), ...]. None is entered in the list for each unrecognized character.
render() 
 draw text on a new Surface render(text, antialias, color, background=None) -> Surface  This creates a new Surface with the specified text rendered on it. pygame provides no way to directly draw text on an existing Surface: instead you must use Font.render() to create an image (Surface) of the text, then blit this image onto another Surface. The text can only be a single line: newline characters are not rendered. Null characters ('x00') raise a TypeError. Both Unicode and char (byte) strings are accepted. For Unicode strings only UCS-2 characters ('u0001' to 'uFFFF') are recognized. Anything greater raises a UnicodeError. For char strings a LATIN1 encoding is assumed. The antialias argument is a boolean: if true the characters will have smooth edges. The color argument is the color of the text [e.g.: (0,0,255) for blue]. The optional background argument is a color to use for the text background. If no background is passed the area outside the text will be transparent. The Surface returned will be of the dimensions required to hold the text. (the same as those returned by Font.size()). If an empty string is passed for the text, a blank surface will be returned that is zero pixel wide and the height of the font. Depending on the type of background and antialiasing used, this returns different types of Surfaces. For performance reasons, it is good to know what type of image will be used. If antialiasing is not used, the return image will always be an 8-bit image with a two-color palette. If the background is transparent a colorkey will be set. Antialiased images are rendered to 24-bit RGB images. If the background is transparent a pixel alpha will be included. Optimization: if you know that the final destination for the text (on the screen) will always have a solid background, and the text is antialiased, you can improve performance by specifying the background color. This will cause the resulting image to maintain transparency information by colorkey rather than (much less efficient) alpha values. If you render '\n' an unknown char will be rendered. Usually a rectangle. Instead you need to handle new lines yourself. Font rendering is not thread safe: only a single thread can render text at any time.
set_bold() 
 enable fake rendering of bold text set_bold(bool) -> None  Enables the bold rendering of text. This is a fake stretching of the font that doesn't look good on many font types. If possible load the font from a real bold font file. While bold, the font will have a different width than when normal. This can be mixed with the italic and underline modes.  Note This is the same as the bold attribute.
set_italic() 
 enable fake rendering of italic text set_italic(bool) -> None  Enables fake rendering of italic text. This is a fake skewing of the font that doesn't look good on many font types. If possible load the font from a real italic font file. While italic the font will have a different width than when normal. This can be mixed with the bold and underline modes.  Note This is the same as the italic attribute.
set_underline() 
 control if text is rendered with an underline set_underline(bool) -> None  When enabled, all rendered fonts will include an underline. The underline is always one pixel thick, regardless of font size. This can be mixed with the bold and italic modes.  Note This is the same as the underline attribute.
size() 
 determine the amount of space needed to render text size(text) -> (width, height)  Returns the dimensions needed to render the text. This can be used to help determine the positioning needed for text before it is rendered. It can also be used for wordwrapping and other layout effects. Be aware that most fonts use kerning which adjusts the widths for specific letter pairs. For example, the width for "ae" will not always match the width for "a" + "e".
underline 
 Gets or sets whether the font should be rendered with an underline. underline -> bool  Whether the font should be rendered in underline. When set to True, all rendered fonts will include an underline. The underline is always one pixel thick, regardless of font size. This can be mixed with the bold and italic modes.  New in pygame 2.0.0.
pygame.font.get_default_font() 
 get the filename of the default font get_default_font() -> string  Return the filename of the system font. This is not the full path to the file. This file can usually be found in the same directory as the font module, but it can also be bundled in separate archives.
pygame.font.get_fonts() 
 get all available fonts get_fonts() -> list of strings  Returns a list of all the fonts available on the system. The names of the fonts will be set to lowercase with all spaces and punctuation removed. This works on most systems, but some will return an empty list if they cannot find fonts.
pygame.font.get_init() 
 true if the font module is initialized get_init() -> bool  Test if the font module is initialized or not.
pygame.font.init() 
 initialize the font module init() -> None  This method is called automatically by pygame.init(). It initializes the font module. The module must be initialized before any other functions will work. It is safe to call this function more than once.
pygame.font.match_font() 
 find a specific font on the system match_font(name, bold=False, italic=False) -> path  Returns the full path to a font file on the system. If bold or italic are set to true, this will attempt to find the correct family of font. The font name can also be an iterable of font names, a string of comma-separated font names, or a bytes of comma-separated font names, in which case the set of names will be searched in order. If none of the given names are found, None is returned.  New in pygame 2.0.1: Accept an iterable of font names.  Example: print pygame.font.match_font('bitstreamverasans')
# output is: /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
# (but only if you have Vera on your system)
pygame.font.quit() 
 uninitialize the font module quit() -> None  Manually uninitialize SDL_ttf's font system. This is called automatically by pygame.quit(). It is safe to call this function even if font is currently not initialized.
pygame.font.SysFont() 
 create a Font object from the system fonts SysFont(name, size, bold=False, italic=False) -> Font  Return a new Font object that is loaded from the system fonts. The font will match the requested bold and italic flags. Pygame uses a small set of common font aliases. If the specific font you ask for is not available, a reasonable alternative may be used. If a suitable system font is not found this will fall back on loading the default pygame font. The font name can also be an iterable of font names, a string of comma-separated font names, or a bytes of comma-separated font names, in which case the set of names will be searched in order.  New in pygame 2.0.1: Accept an iterable of font names.