{"library":"pyobjc-framework-pencilkit","title":"PencilKit Framework for PyObjC","description":"pyobjc-framework-pencilkit provides Python wrappers for Apple's PencilKit framework on macOS. It is part of the PyObjC project, a bidirectional bridge enabling Python scripts to interact with Objective-C libraries, including macOS Cocoa frameworks. The current version is 12.1 and it maintains an active release cadence, typically aligning with macOS SDK updates and Python version support.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-pencilkit"],"cli":null},"imports":["from PencilKit import PKCanvasView","from PencilKit import PKToolPicker"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import AppKit\nimport Foundation\nimport PencilKit\nfrom PyObjCTools import AppHelper\n\nclass PyPencilKitDelegate(AppKit.NSObject):\n    def applicationDidFinishLaunching_(self, notification):\n        # Create a window\n        self.window = AppKit.NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(\n            Foundation.NSRect((100, 100), (600, 400)),\n            AppKit.NSWindowStyleMaskTitled | AppKit.NSWindowStyleMaskClosable | AppKit.NSWindowStyleMaskResizable,\n            AppKit.NSBackingStoreBuffered,\n            False\n        )\n        self.window.setTitle_(\"PyObjC PencilKit Demo\")\n        self.window.setDelegate_(self)\n\n        # Create a PKCanvasView\n        self.canvasView = PencilKit.PKCanvasView.alloc().initWithFrame_(self.window.contentView().bounds())\n        self.canvasView.setAutoresizingMask_(AppKit.NSViewWidthSizable | AppKit.NSViewHeightSizable)\n        self.canvasView.setDrawingPolicy_(PencilKit.PKCanvasViewDrawingPolicyAnyInput) # Allow finger drawing\n\n        # Create and configure a PKToolPicker\n        self.toolPicker = PencilKit.PKToolPicker.alloc().init()\n        self.toolPicker.setVisible_forFirstResponder_(True, self.canvasView) # Make visible for the canvas\n        self.toolPicker.addObserver_(self.canvasView) # Canvas observes tool changes\n\n        self.window.contentView().addSubview_(self.canvasView)\n        self.window.makeKeyAndOrderFront_(None)\n\n        # Make canvas first responder to receive drawing input\n        self.window.makeFirstResponder_(self.canvasView)\n\n    def applicationShouldTerminateAfterLastWindowClosed_(self, sender):\n        return True\n\nif __name__ == \"__main__\":\n    app = AppKit.NSApplication.sharedApplication()\n    delegate = PyPencilKitDelegate.alloc().init()\n    app.setDelegate_(delegate)\n    AppHelper.runEventLoop()","lang":"python","description":"This quickstart demonstrates how to create a basic macOS application using PyObjC that displays a `PKCanvasView` and a `PKToolPicker` for drawing. It sets up a standard Cocoa application window and integrates PencilKit components, allowing for user interaction with an Apple Pencil or trackpad/mouse.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":null,"pypi_latest":"12.1","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.3,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.7,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyobjc-framework-pencilkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.9,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}