pygame.sdl2_video

Warning

This module isn't ready for prime time yet, it's still in development. These docs are primarily meant to help the pygame developers and super-early adopters who are in communication with the developers. This API will change.

pygame object that represents a window
pygame object that representing a Texture.
Easy way to use a portion of a Texture without worrying about srcrect all the time.
Create a 2D rendering context for a window.
Experimental pygame module for porting new SDL video systems
pygame._sdl2.video.Window
pygame object that represents a window
Window(title="pygame", size=(640, 480), position=None, fullscreen=False, fullscreen_desktop=False, keywords) -> Window
Creates window using window created by pygame.display.set_mode().
Gets or sets whether the mouse is confined to the window.
Gets or sets the window's relative mouse motion state.
Enable windowed mode (exit fullscreen).
Enter fullscreen.
Gets or sets whether the window title.
Destroys the window.
Hide the window.
Show the window.
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.
Maximize the window.
Minimize the window.
Gets and sets whether the window is resizable.
Add or remove the border from the window.
Set the icon for the window.
Get the unique window ID. *Read-only*
Gets and sets the window size.
Gets and sets the window position.
Gets and sets the window opacity. Between 0.0 (fully transparent) and 1.0 (fully opaque).
Gets and sets the brightness (gamma multiplier) for the display that owns the window.
Get the index of the display that owns the window. *Read-only*
Set the window as a modal for a parent window. This function is only supported on X11.
classmethod from_display_module()
Creates window using window created by pygame.display.set_mode().
from_display_module() -> Window
grab
Gets or sets whether the mouse is confined to the window.
grab -> bool
relative_mouse
Gets or sets the window's relative mouse motion state.
relative_mouse -> bool
set_windowed()
Enable windowed mode (exit fullscreen).
set_windowed() -> None
set_fullscreen()
Enter fullscreen.
set_fullscreen(desktop=False) -> None
title
Gets or sets whether the window title.
title -> string
destroy()
Destroys the window.
destroy() -> None
hide()
Hide the window.
hide() -> None
show()
Show the window.
show() -> None
focus()
Raise the window above other windows and set the input focus. The "input_only" argument is only supported on X11.
focus(input_only=False) -> None
restore()
Restore the size and position of a minimized or maximized window.
restore() -> None
maximize()
Maximize the window.
maximize() -> None
minimize()
Minimize the window.
maximize() -> None
resizable
Gets and sets whether the window is resizable.
resizable -> bool
borderless
Add or remove the border from the window.
borderless -> bool
set_icon()
Set the icon for the window.
set_icon(surface) -> None
id
Get the unique window ID. *Read-only*
id -> int
size
Gets and sets the window size.
size -> (int, int)
position
Gets and sets the window position.
position -> (int, int) or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED
opacity
Gets and sets the window opacity. Between 0.0 (fully transparent) and 1.0 (fully opaque).
opacity -> float
brightness
Gets and sets the brightness (gamma multiplier) for the display that owns the window.
brightness -> float
display_index
Get the index of the display that owns the window. *Read-only*
display_index -> int
set_modal_for()
Set the window as a modal for a parent window. This function is only supported on X11.
set_modal_for(Window) -> None
pygame._sdl2.video.Texture
pygame object that representing a Texture.
Texture(renderer, size, depth=0, static=False, streaming=False, target=False) -> Texture
Create a texture from an existing surface.
Gets the renderer associated with the Texture. *Read-only*
Gets the width of the Texture. *Read-only*
Gets the height of the Texture. *Read-only*
Gets and sets an additional alpha value multiplied into render copy operations.
Gets and sets the blend mode for the Texture.
Gets and sets an additional color value multiplied into render copy operations.
Get the rectangular area of the texture.
Copy a portion of the texture to the rendering target.
Update the texture with a Surface. WARNING: Slow operation, use sparingly.
static from_surface()
Create a texture from an existing surface.
from_surface(renderer, surface) -> Texture
renderer
Gets the renderer associated with the Texture. *Read-only*
renderer -> Renderer
width
Gets the width of the Texture. *Read-only*
width -> int
height
Gets the height of the Texture. *Read-only*
height -> int
alpha
Gets and sets an additional alpha value multiplied into render copy operations.
alpha -> int
blend_mode
Gets and sets the blend mode for the Texture.
blend_mode -> int
color
Gets and sets an additional color value multiplied into render copy operations.
color -> color
get_rect()
Get the rectangular area of the texture.
get_rect(**kwargs) -> Rect
draw()
Copy a portion of the texture to the rendering target.
draw(srcrect=None, dstrect=None, angle=0, origin=None, flipX=False, flipY=False) -> None
update()
Update the texture with a Surface. WARNING: Slow operation, use sparingly.
update(surface, area=None) -> None
pygame._sdl2.video.Image
Easy way to use a portion of a Texture without worrying about srcrect all the time.
Image(textureOrImage, srcrect=None) -> Image
Get the rectangular area of the Image.
Copy a portion of the Image to the rendering target.
Gets and sets the angle the Image draws itself with.
Gets and sets the origin. Origin=None means the Image will be rotated around its center.
Gets and sets whether the Image is flipped on the x axis.
Gets and sets whether the Image is flipped on the y axis.
Gets and sets the Image color modifier.
Gets and sets the Image alpha modifier.
Gets and sets the blend mode for the Image.
Gets and sets the Texture the Image is based on.
Gets and sets the Rect the Image is based on.
get_rect()
Get the rectangular area of the Image.
get_rect() -> Rect
draw()
Copy a portion of the Image to the rendering target.
draw(srcrect=None, dstrect=None) -> None
angle
Gets and sets the angle the Image draws itself with.
angle -> float
origin
Gets and sets the origin. Origin=None means the Image will be rotated around its center.
origin -> (float, float) or None.
flipX
Gets and sets whether the Image is flipped on the x axis.
flipX -> bool
flipY
Gets and sets whether the Image is flipped on the y axis.
flipY -> bool
color
Gets and sets the Image color modifier.
color -> Color
alpha
Gets and sets the Image alpha modifier.
alpha -> float
blend_mode
Gets and sets the blend mode for the Image.
blend_mode -> int
texture
Gets and sets the Texture the Image is based on.
texture -> Texture
srcrect
Gets and sets the Rect the Image is based on.
srcrect -> Rect
pygame._sdl2.video.Renderer
Create a 2D rendering context for a window.
Renderer(window, index=-1, accelerated=-1, vsync=False, target_texture=False) -> Renderer
Easy way to create a Renderer.
Gets and sets the blend mode used by the drawing functions.
Gets and sets the color used by the drawing functions.
Clear the current rendering target with the drawing color.
Updates the screen with any new rendering since previous call.
Returns the drawing area on the target.
Set the drawing area on the target. If area is None, the entire target will be used.
Gets and sets the logical size.
Gets and sets the scale.
Gets and sets the render target. None represents the default target (the renderer).
For compatibility purposes. Textures created by different Renderers cannot be shared!
Draws a line.
Draws a point.
Draws a rectangle.
Fills a rectangle.
Read pixels from current render target and create a pygame.Surface. WARNING: Slow operation, use sparingly.
classmethod from_window()
Easy way to create a Renderer.
from_window(window) -> Renderer
draw_blend_mode
Gets and sets the blend mode used by the drawing functions.
draw_blend_mode -> int
draw_color
Gets and sets the color used by the drawing functions.
draw_color -> Color
clear()
Clear the current rendering target with the drawing color.
clear() -> None
present()
Updates the screen with any new rendering since previous call.
present() -> None
get_viewport()
Returns the drawing area on the target.
get_viewport() -> Rect
set_viewport()
Set the drawing area on the target. If area is None, the entire target will be used.
set_viewport(area) -> None
logical_size
Gets and sets the logical size.
logical_size -> (int width, int height)
scale
Gets and sets the scale.
scale -> (float x_scale, float y_scale)
target
Gets and sets the render target. None represents the default target (the renderer).
target -> Texture or None
blit()
For compatibility purposes. Textures created by different Renderers cannot be shared!
blit(soure, dest, area=None, special_flags=0)-> Rect
draw_line()
Draws a line.
draw_line(p1, p2) -> None
draw_point()
Draws a point.
draw_point(point) -> None
draw_rect()
Draws a rectangle.
draw_rect(rect)-> None
fill_rect()
Fills a rectangle.
fill_rect(rect)-> None
to_surface()
Read pixels from current render target and create a pygame.Surface. WARNING: Slow operation, use sparingly.
to_surface(surface=None, area=None)-> Surface



Edit on GitHub