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, flip_x=False, flip_y=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.
flip_x露
Gets and sets whether the Image is flipped on the x axis.
flip_x -> bool
flip_y露
Gets and sets whether the Image is flipped on the y axis.
flip_y -> 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(source, 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