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_display ()

get_geometry ()

get_height_mm ()

get_manufacturer ()

get_model ()

get_refresh_rate ()

get_scale_factor ()

get_subpixel_layout ()

get_width_mm ()

get_workarea ()

is_primary ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

display

Gdk.Display

r/w/co

The display of the monitor

geometry

Gdk.Rectangle

r

The geometry of the monitor

height-mm

int

r

The height of the monitor, in millimeters

manufacturer

str

r

The manufacturer name

model

str

r

The model name

refresh-rate

int

r

The refresh rate, in millihertz

scale-factor

int

r

The scale factor

subpixel-layout

Gdk.SubpixelLayout

r

The subpixel layout

width-mm

int

r

The width of the monitor, in millimeters

workarea

Gdk.Rectangle

r

The workarea of the monitor

Signals

Inherited:

GObject.Object (1)

Name

Short Description

invalidate

Fields

Inherited:

GObject.Object (1)

Class Details

class Gdk.Monitor(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gdk.MonitorClass

Gdk.Monitor objects represent the individual outputs that are associated with a Gdk.Display. Gdk.Display has APIs to enumerate monitors with Gdk.Display.get_n_monitors() and Gdk.Display.get_monitor(), and to find particular monitors with Gdk.Display.get_primary_monitor() or Gdk.Display.get_monitor_at_window().

Gdk.Monitor was introduced in GTK+ 3.22 and supersedes earlier APIs in Gdk.Screen to obtain monitor-related information.

get_display()[source]
Returns:

the display

Return type:

Gdk.Display

Gets the display that this monitor belongs to.

New in version 3.22.

get_geometry()[source]
Returns:

a Gdk.Rectangle to be filled with the monitor geometry

Return type:

geometry: Gdk.Rectangle

Retrieves the size and position of an individual monitor within the display coordinate space. The returned geometry is in ”application pixels”, not in ”device pixels” (see Gdk.Monitor.get_scale_factor()).

New in version 3.22.

get_height_mm()[source]
Returns:

the physical height of the monitor

Return type:

int

Gets the height in millimeters of the monitor.

New in version 3.22.

get_manufacturer()[source]
Returns:

the name of the manufacturer, or None

Return type:

str or None

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

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

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

get_model()[source]
Returns:

the monitor model, or None

Return type:

str or None

Gets the a 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.

New in version 3.22.

get_scale_factor()[source]
Returns:

the scale factor

Return type:

int

Gets the internal scale factor that maps from monitor coordinates to the actual device pixels. On traditional systems this is 1, but on very high density outputs this 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 window where it is better to use Gdk.Window.get_scale_factor() instead.

New in version 3.22.

get_subpixel_layout()[source]
Returns:

the subpixel layout

Return type:

Gdk.SubpixelLayout

Gets information about the layout of red, green and blue primaries for each pixel in this monitor, if available.

New in version 3.22.

get_width_mm()[source]
Returns:

the physical width of the monitor

Return type:

int

Gets the width in millimeters of the monitor.

New in version 3.22.

get_workarea()[source]
Returns:

a Gdk.Rectangle to be filled with the monitor workarea

Return type:

workarea: Gdk.Rectangle

Retrieves the size and position of the “work area” on a monitor within the display coordinate space. The returned geometry is in ”application pixels”, not in ”device pixels” (see Gdk.Monitor.get_scale_factor()).

The work area should be considered when positioning menus and similar popups, to avoid placing them below panels, docks or other desktop components.

Note that not all backends may have a concept of workarea. This function will return the monitor geometry if a workarea is not available, or does not apply.

New in version 3.22.

is_primary()[source]
Returns:

True if self is primary

Return type:

bool

Gets whether this monitor should be considered primary (see Gdk.Display.get_primary_monitor()).

New in version 3.22.

Signal Details

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

invalidate

Flags:

RUN_FIRST

Parameters:

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

Property Details

Gdk.Monitor.props.display
Name:

display

Type:

Gdk.Display

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The display 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 millihertz

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.width_mm
Name:

width-mm

Type:

int

Default Value:

0

Flags:

READABLE

The width of the monitor, in millimeters

Gdk.Monitor.props.workarea
Name:

workarea

Type:

Gdk.Rectangle

Default Value:

None

Flags:

READABLE

The workarea of the monitor