{"id":2703,"library":"pyobjc-framework-quartz","title":"PyObjC Framework Quartz","description":"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.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macOS","Objective-C","bindings","Cocoa","Quartz","Core Graphics"],"install":[{"cmd":"pip install pyobjc-framework-quartz","lang":"bash","label":"Install PyObjC Quartz Bindings"}],"dependencies":[{"reason":"Core bridge for Objective-C and Python, required by all PyObjC framework packages.","package":"pyobjc-core","optional":false}],"imports":[{"symbol":"Quartz","correct":"import Quartz"},{"symbol":"CGMainDisplayID","correct":"from Quartz import CGMainDisplayID"}],"quickstart":{"code":"import Quartz\n\n# Get the main display ID\nmain_display_id = Quartz.CGMainDisplayID()\n\n# Get the bounds of the main display\nmain_display_bounds = Quartz.CGDisplayBounds(main_display_id)\n\nprint(f\"Main Display ID: {main_display_id}\")\nprint(f\"Main Display Bounds: {main_display_bounds}\")\nprint(f\"Origin: ({main_display_bounds.origin.x}, {main_display_bounds.origin.y})\")\nprint(f\"Size: ({main_display_bounds.size.width}, {main_display_bounds.size.height})\")\n","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python interpreter to 3.10 or newer, or use an older `pyobjc` release compatible with your Python version.","message":"PyObjC has dropped support for older Python versions. Version 12.0 dropped support for Python 3.9, and version 11.0 dropped Python 3.8. Ensure your environment meets the current minimum requirement (Python >=3.10).","severity":"breaking","affected_versions":">=11.0"},{"fix":"Carefully review and adapt any Python code that directly interacts with Objective-C `init` methods or performs manual memory management to ensure it adheres to the new ARC model.","message":"Version 11.1 introduced a significant change in how PyObjC handles memory management for Objective-C 'init' family methods, aligning with clang's Automatic Reference Counting (ARC) documentation. This change in object ownership semantics can lead to memory leaks or crashes in existing code that manually manages references.","severity":"breaking","affected_versions":">=11.1"},{"fix":"If experiencing issues with object initialization during subclassing, review the `pyobjc-core` documentation on `__init__`/`__new__` behavior and ensure your class's construction aligns with PyObjC's Objective-C integration rules.","message":"The interaction between Python's `__init__` and `__new__` methods when subclassing Objective-C classes can be complex. While `v10.3` initially restricted `__init__` calls, `v10.3.1` partially re-enabled it for classes with a user-implemented `__new__`. However, classes relying on PyObjC's default `__new__` still cannot use `__init__`.","severity":"gotcha","affected_versions":">=10.3"},{"fix":"Consult the `pyobjc` documentation regarding free-threading compatibility for your specific version and Python interpreter. Exercise caution and thorough testing if utilizing free-threading features.","message":"PyObjC v11.0 introduced experimental support for Python's free-threading (PEP 703) for Python 3.13+. However, earlier versions (e.g., v10.3) explicitly stated no support for free threading. Using PyObjC with free-threading, especially outside Python 3.13+ or in ways not fully tested, might lead to unstable behavior.","severity":"gotcha","affected_versions":">=10.3, <=11.0"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}