Display Class

Inheritance diagram of Display

class Display(name=None, x_screen=None)

A display device supporting one or more screens.

See also

Programming Guide - Displays

Note

Since pyglet 1.2

Constructor:

__init__(name=None, x_screen=None)

Create a display connection for the given name and screen.

On X11, name is of the form "hostname:display", where the default is usually ":1". On X11, x_screen gives the X screen number to use with this display. A pyglet display can only be used with one X screen; open multiple display connections to access multiple X screens.

Note that TwinView, Xinerama, xrandr and other extensions present multiple monitors on a single X screen; this is usually the preferred mechanism for working with multiple monitors under X11 and allows each screen to be accessed through a single pyglet Display.

On platforms other than X11, name and x_screen are ignored; there is only a single display device on these systems.

Parameters:
  • name (str) – The name of the display to connect to.
  • x_screen (int) – The X11 screen number to use.

Methods:

get_default_screen() Get the default screen as specified by the user’s operating system preferences.
get_screens() Get the available screens.
get_windows() Get the windows currently attached to this display.

Attributes:

Methods

Display.get_default_screen()

Get the default screen as specified by the user’s operating system preferences.

Return type:Screen
Display.get_screens()

Get the available screens.

A typical multi-monitor workstation comprises one Display with multiple Screen s. This method returns a list of screens which can be enumerated to select one for full-screen display.

For the purposes of creating an OpenGL config, the default screen will suffice.

Return type:list of Screen
Display.get_windows()

Get the windows currently attached to this display.

Return type:sequence of Window

Attributes

Display.name = None

Name of this display, if applicable.

Type:str
Display.x_screen = None

The X11 screen number of this display, if applicable.

Type:int

Table Of Contents

Previous topic

Canvas Class

Next topic

Screen Class