##### pygame documentation

Pygame Home || Help Contents || Reference Index

Most useful stuff: Color | display | draw | event | font | image | key | locals | mixer | mouse | Rect | Surface | time | music | pygame

Advanced stuff: cursors | joystick | mask | sprite | transform | BufferProxy | freetype | gfxdraw | midi | PixelArray | pixelcopy | sndarray | surfarray | math

Other: camera | controller | examples | fastevent | scrap | tests | touch | version

`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.

  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
    classmethod from_display_module()
      Creates window using window created by pygame.display.set_mode().
      from_display_module() -> Window
    classmethod from_window()
      Create Window from another window. Could be from another UI toolkit.
      from_window(other) -> 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
    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
    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_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
    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