tut/en/Red_or_Black/5.HP_bar/Advanced OUTPUT with Advanced PROCESS

tut/en/Red_or_Black/6.Buttons/Advanced INPUT with Advanced OUTPUT

Slots and c_api - Making functions and data available from other modules

Changed in pygame 1.9.5: Added the optional keyword parameter fill.

Changed in pygame 1.9.5: Added support for masks with a width and/or a
height of 0.

Changed in pygame 1.9.2: Color objects export the C level array interface.

New in pygame 1.9.2: pygame.mixer.Sound keyword arguments and array interface support

New in pygame 1.9.2: array struct interface

transpose method

broadcasting for a length 1 dimension

Changed in pygame 1.9.2: A 2D PixelArray can have a length 1 dimension.
Only an integer index on a 2D PixelArray returns a 1D array.

For assignment, a tuple can only be a color. Any other sequence type
is a sequence of colors.

New in pygame 1.9.2: The Rect class can be subclassed. Methods such as copy() and move()
will recognize this and return instances of the subclass.
However, the subclass's __init__() method is not called,
and __new__() is assumed to take no arguments. So these methods should be
overridden if any extra attributes need to be copied.

New in pygame 1.9.2: Optional special_flags: BLEND_PREMULTIPLIED

Changed in pygame 2.0.2: Fixed amount horizontal scroll (x, positive to the right and negative to the left).

Changed in pygame 2.0.2: The touch attribute was added to all the MOUSE events.

Changed in pygame 2.0.2: Mask functions now support keyword arguments.

Changed in pygame 2.0.2: Mask functions that take positions or offsets now
support pygame.math.Vector2 arguments.

Changed in pygame 2.0.2: transform functions now support keyword arguments.

Changed in pygame 2.0.3: Rendering UCS4 unicode works and does not
raise an exception. Use if hasattr(pygame.font, "UCS4"): to see if
pygame supports rendering UCS4 unicode including more languages and
emoji.

Changed in pygame 2.0.0: Support for tuples, lists, and Color objects when creating
Color objects.

Changed in pygame 2.0.0: Added support for keyword arguments.
Nothing is drawn when the radius is 0 (a pixel at the center coordinates
used to be drawn when the radius equaled 0).
Floats, and Vector2 are accepted for the center param.
The drawing algorithm was improved to look more like a circle.

Changed in pygame 2.0.0: The joy attribute was deprecated, instance_id was added.

Changed in pygame 2.0.0: The namehint parameter was added to make it possible
to save other formats than TGA to a file-like object.
Saving to a file-like object with JPEG is possible.

Changed in pygame 2.0.0: Joystick objects are now opened immediately on creation.

Deprecated since pygame 2.0.0: In future it will not be possible to reinitialise a closed Joystick
object. Will be removed in Pygame 2.1.

Deprecated since pygame 2.0.0: The original device index is not useful in pygame 2. Use
get_instance_id() instead. Will be removed in Pygame 2.1.

New in pygame 2.0.0: The pygame.TEXTINPUT event is preferred to the unicode attribute
of pygame.KEYDOWN. The attribute text contains the input.

Changed in pygame 2.0.0: A ValueError is now raised (instead of a
pygame.error) if delay or interval is < 0.

Changed in pygame 2.0.0: Shallow copy support added. The Mask class supports the special
method __copy__() and shallow copying via copy.copy(mask).

Changed in pygame 2.0.0: Subclassing support added. The Mask class
can be used as a base class.

Changed in pygame 2.0.0: The default buffersize changed from 4096 to 512.

Changed in pygame 2.0.0: The default frequency changed from 22050 to 44100.

New in pygame 2.0.0: Optional special_flags:  BLEND_ALPHA_SDL2 - Uses the SDL2 blitter for alpha blending,
this gives different results than the default blitter, which is modelled after SDL1, due to
different approximations used for the alpha blending formula. The SDL2 blitter also supports
RLE on alpha blended surfaces which the pygame one does not.

Changed in pygame 1.9.0: Color objects support 4-element tuples of integers.

New in pygame 1.8.1: Optional special_flags: BLEND_RGBA_ADD, BLEND_RGBA_SUB,
BLEND_RGBA_MULT, BLEND_RGBA_MIN, BLEND_RGBA_MAX
BLEND_RGB_ADD, BLEND_RGB_SUB, BLEND_RGB_MULT,
BLEND_RGB_MIN, BLEND_RGB_MAX.

Changed in pygame 2.1.3: pygame now ensures that subsequent calls to this function clears the
window to black. On older versions, this was an implementation detail
on the major platforms this function was tested with.

New in pygame 2.1.3: Added precise_x and precise_y to MOUSEWHEEL events

New in pygame 2.1.3: KEYMAPCHANGED, CLIPBOARDUPDATE,
RENDER_TARGETS_RESET, RENDER_DEVICE_RESET and LOCALECHANGED

New in pygame 2.1.3: WINDOWICCPROFCHANGED and WINDOWDISPLAYCHANGED

Changed in pygame 2.1.3: Checks through user fonts instead of just global fonts for Windows.

Changed in pygame 2.1.3: Added use_compat argument and guaranteed API stability for it

Changed in pygame 2.1.3: Inherited methods of vector subclasses now correctly return an instance of the
subclass instead of the superclass

Changed in pygame 2.0.1: The unicode attribute was added to KEYUP event.

Changed in pygame 2.0.1: returns a boolean, previously returned None

Changed in pygame 2.0.1: This function is always available, but raises an
NotImplementedError if extended image formats are
not supported.
Previously, this function may or may not be
available, depending on the state of extended image
format support.

Changed in pygame 2.0.1: event argument supports pygame.event.Event object

New in pygame 2.0.1: added loops argument to replace once argument

New in pygame 2.5.0: Iteration over the collection of bools returned by get_pressed is now
restored. However it still does not make sense to iterate over it. Currently.

Changed in pygame 2.2.0: linked keyword argument added and default behavior changed from returning compiled version to returning linked version

New in pygame 2.2.0: The collection of bools returned by get_pressed can not be iterated
over because the indexes of the internal tuple does not correspond to the
keycodes.

Changed in pygame 2.2.0: round returns a new vector with components rounded to the specified digits.

Changed in pygame 2.1.1: Drawing rects with width now draws the width correctly inside the
rect's area, rather than using an internal call to draw.lines(),
which had half the width spill outside the rect area.

Changed in pygame 2.0.0.dev8: Added support for drawing circle quadrants.

Changed in pygame 2.0: per-surface alpha can be combined with per-pixel
alpha.

Changed in pygame 1.8: The default buffersize changed from 1024 to 3072.

New in pygame 1.8: Optional special_flags: BLEND_ADD, BLEND_SUB,
BLEND_MULT, BLEND_MIN, BLEND_MAX.

Changed in pygame 1.9.4: Allow scalar construction like GLSL Vector2(2) == Vector2(2.0, 2.0)

Changed in pygame 1.9.4: pygame.math import not required. More convenient pygame.Vector2 and pygame.Vector3.

New in pygame 1.9.4: close() method was added. For explicitly cleaning up.

being able to use PixelArray as a context manager for cleanup.

both of these are useful for when working without reference counting (pypy).

Changed in pygame 1.9.4: Fixed a lot of bugs and added keyword arguments. Test your code.

Changed in pygame 1.9.1: The default buffersize changed from 3072 to 4096.

Changed in pygame 1.9.6: str(pygame.version.vernum) returns a string like "2.0.0" instead
of "(2, 0, 0)".

Changed in pygame 1.9.6: repr(pygame.version.vernum) returns a string like
"PygameVersion(major=2, minor=0, patch=0)" instead of "(2, 0, 0)".

Changed in pygame 2.0.2:: Renamed from add_mapping to set_mapping

Changed in pygame 2.0.2:: Argument type changed from str to dict

New in pygame 1.9: Returning a Color instead of tuple. Use tuple(surf.get_at((x,y)))
if you want a tuple, and not a Color. This should only matter if
you want to use the color as a key in a dict.

New in pygame 1.9: Returning Color(with length 3) instance instead of a tuple.

from_joystick() (pygame._sdl2.controller.Controller static method)

pygame module for interacting with events and queues from multiple
threads.

Pygame module for interacting with joysticks, gamepads, and trackballs.

pygame module for accessing surface pixel data using array interfaces

pygame object to export a surface buffer through an array protocol

set_controls(hflip = bool, vflip = bool, brightness) -> (hflip = bool, vflip = bool, brightness)

returns a Color where the r,g,b components have been multiplied by the alpha.

set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface

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

circle(surface, color, center, radius, width=0, draw_top_right=None, draw_top_left=None, draw_bottom_left=None, draw_bottom_right=None) -> Rect

arc(surface, color, rect, start_angle, stop_angle, width=1) -> Rect

grab enables capture of system keyboard shortcuts like Alt+Tab or the Meta/Super key.

display multiple images bounce off each other using collision detection

testsprite.main(update_rects = True, use_static = False, use_FastRenderGroup = False, screen_dims = [640, 480], use_alpha = False, flags = 0) -> None

scaletest.main(imagefile, convert_alpha=False, run_speed_test=True) -> None

Gets or sets whether the font should be rendered in (faked) bold.

Gets or sets whether the font should be rendered in (faked) italics.

Gets or sets whether the font should be rendered with an underline.

Gets or sets whether the font should be rendered with a strikethrough.

render(text, fgcolor=None, bgcolor=None, style=STYLE_DEFAULT, rotation=0, size=0) -> (Surface, Rect)

render_to(surf, dest, text, fgcolor=None, bgcolor=None, style=STYLE_DEFAULT, rotation=0, size=0) -> Rect

render_raw(text, style=STYLE_DEFAULT, rotation=0, size=0, invert=False) -> (bytes, (int, int))

render_raw_to(array, text, dest=None, style=STYLE_DEFAULT, rotation=0, size=0, invert=False) -> Rect

Font(file, size=0, font_index=0, resolution=0, ucs4=False) -> Font

from_threshold(surface, color, threshold=(0, 0, 0, 255), othersurface=None, palette_colors=1) -> Mask

to_surface(surface=None, setsurface=None, unsetsurface=None, setcolor=(255, 255, 255, 255), unsetcolor=(0, 0, 0, 255), dest=(0, 0)) -> Surface

Creates a Vector2(x, y) or sets x and y from a polar coordinates tuple.

Returns a copy of a vector with the magnitude clamped between max_length and min_length.

rotates the vector around the x-axis by the angle in degrees in place.

rotates the vector around the x-axis by the angle in radians in place.

rotates the vector around the y-axis by the angle in degrees in place.

rotates the vector around the y-axis by the angle in radians in place.

rotates the vector around the z-axis by the angle in degrees in place.

rotates the vector around the z-axis by the angle in radians in place.

returns a tuple with radial distance, inclination and azimuthal angle.

Creates a Vector3(x, y, z) or sets x, y and z from a spherical coordinates 3-tuple.

Converts a frequency into a MIDI note. Rounds to the closest midi note.

init(frequency=44100, size=-16, channels=2, buffer=512, devicename=None, allowedchanges=AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_CHANNELS_CHANGE) -> None

pre_init(frequency=44100, size=-16, channels=2, buffer=512, devicename=None, allowedchanges=AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_CHANNELS_CHANGE) -> None

get_pressed(num_buttons=5) -> (button1, button2, button3, button4, button5)

replace(color, repcolor, distance=0, weights=(0.299, 0.587, 0.114)) -> None

extract(color, distance=0, weights=(0.299, 0.587, 0.114)) -> PixelArray

compare(array, distance=0, weights=(0.299, 0.587, 0.114)) -> PixelArray

surface_to_array(array, surface, kind='P', opaque=255, clear=0) -> None

encode_string([obj [, encoding [, errors [, etype]]]]) -> bytes or None

Checks whether data for a given type is available in the clipboard.

Indicates if the clipboard ownership has been lost by the pygame application.

Check if the given joystick is supported by the game controller interface

Check if the Controller has been opened and is currently connected.

Creates window using window created by pygame.display.set_mode().

Create Window from another window. Could be from another UI toolkit.

Raise the window above other windows and set the input focus. The "input_only" argument is only supported on X11.

Restore the size and position of a minimized or maximized window.

position -> (int, int) or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED

Gets and sets the window opacity. Between 0.0 (fully transparent) and 1.0 (fully opaque).

Set the window as a modal for a parent window. This function is only supported on X11.

Window(title="pygame", size=(640, 480), position=None, fullscreen=False, fullscreen_desktop=False, keywords) -> Window

Gets and sets an additional alpha value multiplied into render copy operations.

Gets and sets an additional color value multiplied into render copy operations.

draw(srcrect=None, dstrect=None, angle=0, origin=None, flip_x=False, flip_y=False) -> None

Update the texture with a Surface. WARNING: Slow operation, use sparingly.

Texture(renderer, size, depth=0, static=False, streaming=False, target=False) -> Texture

Gets and sets the origin. Origin=None means the Image will be rotated around its center.

Easy way to use a portion of a Texture without worrying about srcrect all the time.

Set the drawing area on the target. If area is None, the entire target will be used.

Gets and sets the render target. None represents the default target (the renderer).

For compatibility purposes. Textures created by different Renderers cannot be shared!

Read pixels from current render target and create a pygame.Surface. WARNING: Slow operation, use sparingly.

Renderer(window, index=-1, accelerated=-1, vsync=False, target_texture=False) -> Renderer

A subclass of Sprite that references its Groups weakly. This means that any group this belongs to that is not referenced anywhere else is garbage collected automatically.

A subclass of WeakSprite and DirtySprite that combines the benefits of both classes.

RenderUpdates sub-class that draws Sprites in order of addition.

returns a list of layers defined (unique), sorted from bottom up.

returns all sprites from a layer, ordered by how they where added

LayeredUpdates is a sprite group that handles layers and draws like OrderedUpdates.

clip the area where to draw. Just pass None (default) to reset the clip

LayeredDirty group is for DirtySprite objects.  Subclasses LayeredUpdates.

spritecollide(sprite, group, dokill, collided = None) -> Sprite_list

Collision detection between two sprites, using rects scaled to a ratio.

Collision detection between two sprites, using circles scaled to a ratio.

groupcollide(group1, group2, dokill1, dokill2, collided = None) -> Sprite_dict

blits(blit_sequence=((source, dest), ...), doreturn=1) -> [Rect, ...] or None

blits(((source, dest, area, special_flags), ...)) -> [Rect, ...]

find the absolute position of a child subsurface inside its top level parent

the bitmasks needed to convert between a color and a mapped integer

set the bitmasks needed to convert between a color and a mapped integer

the bit shifts needed to convert between a color and a mapped integer

sets the bit shifts needed to convert between a color and a mapped integer

the significant bits used to convert between a color and a mapped integer

returns a copy of the surface with the RGB channels pre-multiplied by the alpha channel.

Surface((width, height), flags=0, depth=0, masks=None) -> Surface

return smoothscale filter version in use: 'GENERIC', 'MMX', or 'SSE'

set smoothscale filter version to one of: 'GENERIC', 'MMX', or 'SSE'

average_surfaces(surfaces, dest_surface=None, palette_colors=1) -> Surface

average_color(surface, rect=None, consider_alpha=False) -> Color

finds which, and how many pixels in a surface are within a threshold of a 'search_color' or a 'search_surf'.

threshold(dest_surface, surface, search_color, threshold=(0,0,0,0), set_color=(0,0,0,0), set_behavior=1, search_surf=None, inverse_set=False) -> num_threshold_pixels