- (This affected almost every file in some respect, but base.py was the most affected.) Introduced a new API, mss.MSS. This class can be used instead of the previous various MSSBase subclasses, so that the user can work with a consistent class regardless of implementation details. The methods implemented by MSSBase subclasses were renamed, and moved to MSSImplementation subclasses. The mss.MSS class now holds an MSSImplementation instance as an instance variable. (#486, #494)
- Added
primary_monitorproperty to return the primary monitor (or first monitor as fallback).
- Changed
Monitortype fromdict[str, int]todict[str, Any]to support newis_primary(bool, optional),name(str, optional), andunique_id(str, optional) fields. - Added TODO comment for future Monitor class implementation (#470).
- Added
MONITORINFOEXWstructure for extended monitor information. - Added
DISPLAY_DEVICEWstructure for device information. - Added constants:
CCHDEVICENAME,MONITORINFOF_PRIMARY,EDD_GET_DEVICE_INTERFACE_NAME. - Added
GetMonitorInfoWtoCFUNCTIONSfor querying monitor properties. - Added
EnumDisplayDevicesWtoCFUNCTIONSfor querying device details. - Modified
_monitors_impl()callback to extract primary monitor flag, device names, and device interface name (unique_id) using Win32 APIs;unique_idusesEDD_GET_DEVICE_INTERFACE_NAMEwhen available.
- Reworked
_monitors_impl()to prefer XRandR 1.5+GetMonitorswhen available, falling back to enumerating active CRTCs. - Added monitor identification fields from RandR + EDID where available:
is_primary,output,name, andunique_id. - Added EDID lookup via RandR
EDID/EdidDataoutput property and parsing viamss.tools.parse_edid().
- Added
intern_atom()helper with per-connection caching and support for predefined atoms. - Added
XCB_NONEconstant (Atom(0)). - Added additional XRandR request wrappers used for monitor identification (
GetMonitors,GetOutputInfo,GetOutputPrimary,GetOutputProperty).
- Added
InternAtomReplystructure and typed binding forxcb_intern_atom. - Added
__eq__()/__hash__()toXIDfor value-based comparisons.
- Extended the generator to include additional XRandR requests used by the XCB backends (
GetOutputInfo,GetOutputPrimary,GetOutputProperty,GetMonitors). - Updated typedef generation to emit value-based
__eq__()/__hash__()implementations. - Refactored code generation helpers and formatting (use
textwrap.indent/dedent).
- Added
parse_edid()helper for extracting identifying fields (legacy model id, serial number, manufacture/model year, and display name) from EDID blocks.
- Fixed XID type handling for
drawable/visual(avoid mixing raw.valuewith typed IDs).
- Added an
mss()factory to select between the different GNU/Linux backends.
- Moved the legacy Xlib backend into the
mss.linux.xlibmodule to be used as a fallback implementation.
- Added an XCB-based backend that mirrors XGetImage semantics.
- Added an XCB backend powered by XShmGetImage with
shm_statusandshm_fallback_reasonattributes for diagnostics.
- Added
IMAGE_OPTIONS - Added
kCGWindowImageBoundsIgnoreFraming - Added
kCGWindowImageNominalResolution - Added
kCGWindowImageShouldBeOpaque
- Added
OPAQUE
- Added
MAC_VERSION_CATALINA
- Added
BITS_PER_PIXELS_32 - Added
SUPPORTED_BITS_PER_PIXELS
- Removed
XEventclass. UseXErrorEventinstead.
- Added
MSS.close()method - Removed
MSS.bmpattribute - Removed
MSS.memdcattribute
- Added
XErrorEventclass (oldEventclass is just an alias now, and will be removed in v9.0.0)
- Added
compression_level=6keyword argument toMSS.__init__() - Added
display=Nonekeyword argument toMSS.__init__() - Added
max_displays=32keyword argument toMSS.__init__() - Added
with_cursor=Falsekeyword argument toMSS.__init__() - Added
MSS.with_cursorattribute
- Added
MSS.close() - Moved
MSS.__init__()keyword arguments handling to the base class - Renamed
error_handler()function to_error_handler() - Renamed
validate()function to__validate() - Renamed
MSS.has_extension()method to_is_extension_enabled() - Removed
ERRORnamespace - Removed
MSS.drawableattribute - Removed
MSS.rootattribute - Removed
MSS.get_error_details()method. UseScreenShotError.detailsattribute instead.
- Added
CFUNCTIONS
- Added
CFUNCTIONS
- Added
CFUNCTIONS - Added
MONITORNUMPROC - Removed
MSS.monitorenumproc. UseMONITORNUMPROCinstead.
- Added
lock - Added
MSS._grab_impl()(abstract method) - Added
MSS._monitors_impl()(abstract method) MSS.grab()is no more an abstract methodMSS.monitorsis no more an abstract property
- Renamed
MSS.grab()toMSS._grab_impl() - Renamed
MSS.monitorstoMSS._monitors_impl()
- Added
MSS.has_extension() - Removed
MSS.display - Renamed
MSS.grab()toMSS._grab_impl() - Renamed
MSS.monitorstoMSS._monitors_impl()
- Removed
MSS._lock - Renamed
MSS.srcdc_dicttoMSS._srcdc_dict - Renamed
MSS.grab()toMSS._grab_impl() - Renamed
MSS.monitorstoMSS._monitors_impl()
- Renamed back
MSSMixinclass toMSSBase MSSBaseis now derived fromabc.ABCMetaMSSBase.monitoris now an abstract propertyMSSBase.grab()is now an abstract method
- Replaced
MSS.srcdcwithMSS.srcdc_dict
- Added
MSS.__slots__
- Added
MSS.__slots__ - Deleted
MSS.close() - Deleted
LAST_ERRORconstant. UseERRORnamespace instead, specially theERROR.detailsattribute.
- Added
Monitor - Added
Monitors - Added
Pixel - Added
Pixels - Added
Pos - Added
Size
- Added
ScreenShot.__slots__ - Removed
Pos. Usemodels.Posinstead. - Removed
Size. Usemodels.Sizeinstead.
- Added
MSS.__slots__ - Deleted
MSS.close()
- Removed use of
MSS.xlib.XDefaultScreen()4.0.0 (2019-01-11)
- Renamed
MSSBaseclass toMSSMixin
- Renamed
MSS.__del__()method toMSS.close() - Deleted
MSS.last_errorattribute. UseLAST_ERRORconstant instead. - Added
validate()function - Added
MSS.get_error_details()method
- Renamed
MSS.__exit__()method toMSS.close()
- Added
detailsattribute toScreenShotErrorexception. Empty dict by default.
- Added
error_handler()function
- Removed
MSS.scale_factorproperty - Removed
MSS.scale()method
- Added
MSSBase.compression_levelattribute
- Added
MSS.drawableattribute
- Added
Screenshot.bgraattribute
- Changed signature of
to_png(data, size, output=None)toto_png(data, size, level=6, output=None).levelis the Zlib compression level.
- Changed signature of
to_png(data, size, output)toto_png(data, size, output=None). IfoutputisNone, the raw PNG bytes will be returned.
- Added
argsargument tomain()
- Moved
ScreenShotclass toscreenshot.py
- Added
CGPoint.__repr__()function - Added
CGRect.__repr__()function - Added
CGSize.__repr__()function - Removed
get_infinity()function
- Added
MSS.scale()method - Added
MSS.scale_factorproperty
- Added the
ScreenShotclass containing data for a given screenshot (support the Numpy array interface [ScreenShot.__array_interface__]) - Added
shot()method toMSSBase. It takes the same arguments as thesave()method. - Renamed
get_pixelstograb. It now returns aScreenShotobject. - Moved
to_pngmethod totools.py. It is now a simple function. - Removed
enum_display_monitors()method. Usemonitorsproperty instead. - Removed
monitorsattribute. Usemonitorsproperty instead. - Removed
widthattribute. UseScreenShot.size[0]attribute orScreenShot.widthproperty instead. - Removed
heightattribute. UseScreenShot.size[1]attribute orScreenShot.heightproperty instead. - Removed
image. Use theScreenShot.rawattribute orScreenShot.rgbproperty instead. - Removed
bgra_to_rgb()method. UseScreenShot.rgbproperty instead.
- Removed
_crop_width()method. Screenshots are now using the width set by the OS (rounded to 16).
- Renamed
ScreenshotErrorclass toScreenShotError
- Changed signature of
to_png(data, monitor, output)toto_png(data, size, output)wheresizeis atuple(width, height)