PyObjC Framework Quartz

12.1 · active · verified Fri Apr 10

PyObjC Framework Quartz provides Python bindings and wrappers for the Quartz frameworks on macOS, enabling Python applications to interact with macOS's core graphics, windowing, and display services. It is part of the larger PyObjC bridge, building upon pyobjc-core. The current version is 12.1, and new versions are typically released in alignment with macOS SDK updates.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import the Quartz framework and use its Core Graphics functions to retrieve fundamental information about the primary display, such as its identifier and current pixel bounds.

import Quartz

# Get the main display ID
main_display_id = Quartz.CGMainDisplayID()

# Get the bounds of the main display
main_display_bounds = Quartz.CGDisplayBounds(main_display_id)

print(f"Main Display ID: {main_display_id}")
print(f"Main Display Bounds: {main_display_bounds}")
print(f"Origin: ({main_display_bounds.origin.x}, {main_display_bounds.origin.y})")
print(f"Size: ({main_display_bounds.size.width}, {main_display_bounds.size.height})")

view raw JSON →