Monitor classes
The monitor classes are how Dragonfly gets information on the available monitors (a.k.a. screens, displays) for the current platform. Currently the Windows, macOS and X11 (Linux) platforms are supported.
- class BaseMonitor(handle, rectangle)[source]
The base monitor class.
- classmethod get_all_monitors()[source]
Get a list containing each connected monitor.
- Return type:
list
- Returns:
monitors
- classmethod get_monitor(handle, rectangle)[source]
Get a
Monitor
object given a monitor handle.Given the same handle, this method will return the same object.
- Parameters:
handle (int) – monitor handle
rectangle (Rectangle) – monitor rectangle
- Return type:
Monitor
- Returns:
monitor
- property handle
Protected access to handle attribute.
- property is_primary
Whether this is the primary display monitor.
- Return type:
bool
- Returns:
true or false
- property name
The name of this monitor.
- Return type:
str
- Returns:
monitor name
- property rectangle
Protected access to rectangle attribute.
- class FakeMonitor(handle, rectangle)[source]
The monitor class used on unsupported platforms.
- classmethod get_all_monitors()[source]
Get a list containing each connected monitor.
- Return type:
list
- Returns:
monitors
- property name
The name of this monitor.
- Return type:
str
- Returns:
monitor name
- class Win32Monitor(handle, rectangle)[source]
The monitor class used on Win32.
- classmethod get_all_monitors()[source]
Get a list containing each connected monitor.
- Return type:
list
- Returns:
monitors
- property is_primary
Whether this is the primary display monitor.
- Return type:
bool
- Returns:
true or false
- property name
The device name of this monitor.
- Return type:
str
- Returns:
monitor name
- class X11Monitor(name, rectangle)[source]
The monitor class used on X11 (Linux).
This implementation parses monitor information from
xrandr
.- classmethod get_all_monitors()[source]
Get a list containing each connected monitor.
- Return type:
list
- Returns:
monitors
- property is_primary
Whether this is the primary display monitor.
- property name
Protected access to name attribute.
- class DarwinMonitor(handle, rectangle)[source]
The monitor class used on Mac OS (Darwin).
Monitors for Mac OS are not automatically updated because
AppKit
doesn’t update monitor information after it is retrieved. A simple workaround for this is to restart the Python interpreter after a monitor change.- classmethod get_all_monitors()[source]
Get a list containing each connected monitor.
- Return type:
list
- Returns:
monitors
- property name
The name of this monitor.
This module initializes the monitor interface for the current platform.
- class MonitorList[source]
Special read-only, self-updating monitors list class.
Supports indexing and iteration.
- monitors = <dragonfly.windows.monitor.MonitorList object>
MonitorsList
instance