Monitor

class Monitor(**properties: Any)

Superclasses: Object

GdkMonitor objects represent the individual outputs that are associated with a GdkDisplay.

GdkDisplay keeps a GListModel to enumerate and monitor monitors with get_monitors. You can use get_monitor_at_surface to find a particular monitor.

Methods

class Monitor
get_connector() str | None

Gets the name of the monitor’s connector, if available.

These are strings such as “eDP-1”, or “HDMI-2”. They depend on software and hardware configuration, and should not be relied on as stable identifiers of a specific monitor.

get_description() str | None

Gets a string describing the monitor, if available.

This can be used to identify a monitor in the UI.

Added in version 4.10.

get_display() Display

Gets the display that this monitor belongs to.

get_geometry() Rectangle

Retrieves the size and position of the monitor within the display coordinate space.

The returned geometry is in ”application pixels”, not in ”device pixels” (see get_scale).

get_height_mm() int

Gets the height in millimeters of the monitor.

get_manufacturer() str | None

Gets the name or PNP ID of the monitor’s manufacturer.

Note that this value might also vary depending on actual display backend.

The PNP ID registry is located at https://uefi.org/pnp_id_list.

get_model() str | None

Gets the string identifying the monitor model, if available.

get_refresh_rate() int

Gets the refresh rate of the monitor, if available.

The value is in milli-Hertz, so a refresh rate of 60Hz is returned as 60000.

get_scale() float

Gets the internal scale factor that maps from monitor coordinates to device pixels.

This can be used if you want to create pixel based data for a particular monitor, but most of the time you’re drawing to a surface where it is better to use get_scale instead.

Added in version 4.14.

get_scale_factor() int

Gets the internal scale factor that maps from monitor coordinates to device pixels.

On traditional systems this is 1, but on very high density outputs it can be a higher value (often 2).

This can be used if you want to create pixel based data for a particular monitor, but most of the time you’re drawing to a surface where it is better to use get_scale_factor instead.

get_subpixel_layout() SubpixelLayout

Gets information about the layout of red, green and blue primaries for pixels.

get_width_mm() int

Gets the width in millimeters of the monitor.

is_valid() bool

Returns True if the monitor object corresponds to a physical monitor.

The monitor becomes invalid when the physical monitor is unplugged or removed.

Properties

class Monitor
props.connector: str

The connector name.

props.description: str

A short description of the monitor, meant for display to the user.

Added in version 4.10.

props.display: Display

The GdkDisplay of the monitor.

props.geometry: Rectangle

The geometry of the monitor.

props.height_mm: int

The height of the monitor, in millimeters.

props.manufacturer: str

The manufacturer name.

props.model: str

The model name.

props.refresh_rate: int

The refresh rate, in milli-Hertz.

props.scale: float

The scale of the monitor.

Added in version 4.14.

props.scale_factor: int

The scale factor.

The scale factor is the next larger integer, compared to scale.

props.subpixel_layout: SubpixelLayout

The subpixel layout.

props.valid: bool

Whether the object is still valid.

props.width_mm: int

The width of the monitor, in millimeters.

Signals

class Monitor.signals
invalidate() None

Emitted when the output represented by monitor gets disconnected.