{"id":6110,"library":"pyobjc-framework-gamecontroller","title":"PyObjC GameController Framework","description":"PyObjC is a bridge between Python and Apple's Objective-C frameworks on macOS. The `pyobjc-framework-gamecontroller` package provides Python wrappers for the GameController framework, enabling Python applications to interact with game controllers. The library is actively maintained, with releases frequently aligning with new macOS SDKs and Python versions. Current version is 12.1.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","game development","framework","gamecontroller"],"install":[{"cmd":"pip install pyobjc-framework-gamecontroller","lang":"bash","label":"Install `GameController` framework bindings"}],"dependencies":[{"reason":"Provides the core Objective-C bridge functionality required by all PyObjC framework bindings.","package":"pyobjc-core","optional":false}],"imports":[{"note":"Symbols from Objective-C frameworks are typically imported directly from a module named after the framework.","symbol":"GCController","correct":"from GameController import GCController"}],"quickstart":{"code":"import objc\nfrom GameController import GCController\n\ndef list_game_controllers():\n    controllers = GCController.controllers()\n    if controllers:\n        print(f\"Found {len(controllers)} game controllers:\")\n        for controller in controllers:\n            vendor_name = controller.vendorName() or 'Unknown Vendor'\n            print(f\"  - {vendor_name} {controller.productCategory()} (Type: {controller.controllerType()})\")\n            if controller.extendedGamepad():\n                print(\"    Extended Gamepad available.\")\n            elif controller.microGamepad():\n                print(\"    Micro Gamepad available.\")\n    else:\n        print(\"No game controllers found.\")\n\nif __name__ == \"__main__\":\n    list_game_controllers()\n    # In a persistent application, you would typically register for\n    # GCControllerDidConnectNotification and GCControllerDidDisconnectNotification\n    # to dynamically track controller connections/disconnections.","lang":"python","description":"This quickstart demonstrates how to list currently connected game controllers using the `GameController` framework. It iterates through available controllers and prints basic information about them."},"warnings":[{"fix":"Upgrade to Python 3.10+ for PyObjC 12.x, or use an older PyObjC version (e.g., PyObjC 10.x for Python 3.9).","message":"PyObjC 12.0 dropped support for Python 3.9. PyObjC 11.0 dropped support for Python 3.8. Ensure your Python version meets the `requires_python` specification.","severity":"breaking","affected_versions":"11.0, 12.0+"},{"fix":"Review code that interacts with Objective-C `init` methods, especially custom Python subclasses, to ensure correct reference handling under ARC rules.","message":"PyObjC 11.1 changed how initializer methods (e.g., `init` family) handle references to align with Automatic Reference Counting (ARC) behavior. These methods now correctly model stealing a reference to `self` and returning a new one. Code relying on the previous, less accurate reference counting behavior for initializers might experience issues.","severity":"breaking","affected_versions":"11.1+"},{"fix":"Ensure your development and deployment environment is macOS.","message":"PyObjC and its framework wrappers are built exclusively for macOS. This library will not function on Linux, Windows, or other operating systems.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If using a custom `__new__`, carefully verify `__init__` behavior and potentially adjust how objects are initialized or ensure `__new__` is handled consistently with PyObjC's expectations. Consider upgrading to a later version if possible.","message":"PyObjC 10.3 temporarily removed support for calling `__init__` when a class or its superclasses provided a custom `__new__` method. While partially reverted in 10.3.1, users with custom `__new__` implementations should test carefully and adapt `__init__` logic if needed.","severity":"gotcha","affected_versions":"10.3 - 10.3.1"},{"fix":"When utilizing Python 3.13's free-threading with PyObjC, consult the PyObjC documentation for any specific guidelines or known issues related to threading and Objective-C interactions.","message":"PyObjC 11.0 introduced experimental support for Python 3.13's free-threading (PEP 703). While this is a significant enhancement, it is noted as experimental and may have limitations or require careful usage in multithreaded scenarios.","severity":"gotcha","affected_versions":"11.0+"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}