pyglet.canvas

Display and screen management.

Rendering is performed on a Canvas, which conceptually could be an off-screen buffer, the content area of a pyglet.window.Window, or an entire screen. Currently, canvases can only be created with windows (though windows can be set fullscreen).

Windows and canvases must belong to a Display. On Windows and Mac OS X there is only one display, which can be obtained with get_display(). Linux supports multiple displays, corresponding to discrete X11 display connections and screens. get_display() on Linux returns the default display and screen 0 (localhost:0.0); if a particular screen or display is required then Display can be instantiated directly.

Within a display one or more screens are attached. A Screen often corresponds to a physical attached monitor, however a monitor or projector set up to clone another screen will not be listed. Use Display.get_screens() to get a list of the attached screens; these can then be queried for their sizes and virtual positions on the desktop.

The size of a screen is determined by its current mode, which can be changed by the application; see the documentation for Screen.

Note

Since pyglet 1.2

Classes

Canvas Abstract drawing area.
Display A display device supporting one or more screens.
Screen A virtual monitor that supports fullscreen windows.
ScreenMode Screen resolution and display settings.

Functions

get_display() Get the default display device.

Notes

Defined

  • base
  • sys

Table Of Contents

Previous topic

run Function

Next topic

Canvas Class