Gdk.Monitor

g GObject.Object GObject.Object Gdk.Monitor Gdk.Monitor GObject.Object->Gdk.Monitor

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_connector ()

get_description ()

get_display ()

get_geometry ()

get_height_mm ()

get_manufacturer ()

get_model ()

get_refresh_rate ()

get_scale_factor ()

get_subpixel_layout ()

get_width_mm ()

is_valid ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

connector

str

r

description

str

r

display

Gdk.Display

r/w/co

geometry

Gdk.Rectangle

r

height-mm

int

r

manufacturer

str

r

model

str

r

refresh-rate

int

r

scale-factor

int

r

subpixel-layout

Gdk.SubpixelLayout

r

valid

bool

r

width-mm

int

r

Signals

Inherited:

GObject.Object (1)

Name

Short Description

invalidate

Emitted when the output represented by monitor gets disconnected.

Fields

Inherited:

GObject.Object (1)

Class Details

class Gdk.Monitor(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gdk.MonitorClass

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

GdkDisplay keeps a GListModel to enumerate and monitor monitors with [method`Gdk`.Display.get_monitors]. You can use [method`Gdk`.Display.get_monitor_at_surface] to find a particular monitor.

get_connector()[source]
Returns:

the name of the connector

Return type:

str or 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()[source]
Returns:

the monitor description

Return type:

str or None

Gets a string describing the monitor, if available.

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

New in version 4.10.

get_display()[source]
Returns:

the display

Return type:

Gdk.Display

Gets the display that this monitor belongs to.

get_geometry()[source]
Returns:

a GdkRectangle to be filled with the monitor geometry

Return type:

geometry: Gdk.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 [method`Gdk`.Monitor.get_scale_factor]).

get_height_mm()[source]
Returns:

the physical height of the monitor

Return type:

int

Gets the height in millimeters of the monitor.

get_manufacturer()[source]
Returns:

the name of the manufacturer

Return type:

str or 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()[source]
Returns:

the monitor model

Return type:

str or None

Gets the string identifying the monitor model, if available.

get_refresh_rate()[source]
Returns:

the refresh rate in milli-Hertz, or 0

Return type:

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_factor()[source]
Returns:

the scale factor

Return type:

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 [method`Gdk`.Surface.get_scale_factor] instead.

get_subpixel_layout()[source]
Returns:

the subpixel layout

Return type:

Gdk.SubpixelLayout

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

get_width_mm()[source]
Returns:

the physical width of the monitor

Return type:

int

Gets the width in millimeters of the monitor.

is_valid()[source]
Returns:

True if the object corresponds to a physical monitor

Return type:

bool

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

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

Signal Details

Gdk.Monitor.signals.invalidate(monitor)
Signal Name:

invalidate

Flags:

RUN_FIRST

Parameters:

monitor (Gdk.Monitor) – The object which received the signal

Emitted when the output represented by monitor gets disconnected.

Property Details

Gdk.Monitor.props.connector
Name:

connector

Type:

str

Default Value:

None

Flags:

READABLE

The connector name.

Gdk.Monitor.props.description
Name:

description

Type:

str

Default Value:

None

Flags:

READABLE

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

New in version 4.10.

Gdk.Monitor.props.display
Name:

display

Type:

Gdk.Display

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The GdkDisplay of the monitor.

Gdk.Monitor.props.geometry
Name:

geometry

Type:

Gdk.Rectangle

Default Value:

None

Flags:

READABLE

The geometry of the monitor.

Gdk.Monitor.props.height_mm
Name:

height-mm

Type:

int

Default Value:

0

Flags:

READABLE

The height of the monitor, in millimeters.

Gdk.Monitor.props.manufacturer
Name:

manufacturer

Type:

str

Default Value:

None

Flags:

READABLE

The manufacturer name.

Gdk.Monitor.props.model
Name:

model

Type:

str

Default Value:

None

Flags:

READABLE

The model name.

Gdk.Monitor.props.refresh_rate
Name:

refresh-rate

Type:

int

Default Value:

0

Flags:

READABLE

The refresh rate, in milli-Hertz.

Gdk.Monitor.props.scale_factor
Name:

scale-factor

Type:

int

Default Value:

1

Flags:

READABLE

The scale factor.

Gdk.Monitor.props.subpixel_layout
Name:

subpixel-layout

Type:

Gdk.SubpixelLayout

Default Value:

Gdk.SubpixelLayout.UNKNOWN

Flags:

READABLE

The subpixel layout.

Gdk.Monitor.props.valid
Name:

valid

Type:

bool

Default Value:

True

Flags:

READABLE

Whether the object is still valid.

Gdk.Monitor.props.width_mm
Name:

width-mm

Type:

int

Default Value:

0

Flags:

READABLE

The width of the monitor, in millimeters.