Registry / pyobjc-framework-pencilkit

pyobjc-framework-pencilkit

JSON →
library12.2pypypiunverified

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.

pip install pyobjc-framework-pencilkit
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-P
P
pyobjc-framework-pencilkit
pythonv12.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PKCanvasView
from PencilKit import PKCanvasView
from pyobjc_framework_pencilkit import PKCanvasView
PyObjC framework wrappers expose their classes directly under the framework's name, not the PyPI package name.
PKToolPicker
from PencilKit import PKToolPicker
import PyObjC.PencilKit.PKToolPicker
Classes are imported directly from the top-level framework module.

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.

import AppKit import Foundation import PencilKit from PyObjCTools import AppHelper class PyPencilKitDelegate(AppKit.NSObject): def applicationDidFinishLaunching_(self, notification): # Create a window self.window = AppKit.NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( Foundation.NSRect((100, 100), (600, 400)), AppKit.NSWindowStyleMaskTitled | AppKit.NSWindowStyleMaskClosable | AppKit.NSWindowStyleMaskResizable, AppKit.NSBackingStoreBuffered, False ) self.window.setTitle_("PyObjC PencilKit Demo") self.window.setDelegate_(self) # Create a PKCanvasView self.canvasView = PencilKit.PKCanvasView.alloc().initWithFrame_(self.window.contentView().bounds()) self.canvasView.setAutoresizingMask_(AppKit.NSViewWidthSizable | AppKit.NSViewHeightSizable) self.canvasView.setDrawingPolicy_(PencilKit.PKCanvasViewDrawingPolicyAnyInput) # Allow finger drawing # Create and configure a PKToolPicker self.toolPicker = PencilKit.PKToolPicker.alloc().init() self.toolPicker.setVisible_forFirstResponder_(True, self.canvasView) # Make visible for the canvas self.toolPicker.addObserver_(self.canvasView) # Canvas observes tool changes self.window.contentView().addSubview_(self.canvasView) self.window.makeKeyAndOrderFront_(None) # Make canvas first responder to receive drawing input self.window.makeFirstResponder_(self.canvasView) def applicationShouldTerminateAfterLastWindowClosed_(self, sender): return True if __name__ == "__main__": app = AppKit.NSApplication.sharedApplication() delegate = PyPencilKitDelegate.alloc().init() app.setDelegate_(delegate) AppHelper.runEventLoop()
Debug
Known issues
breakingPyObjC frequently drops support for older Python versions. PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped Python 3.8. Ensure your Python version is compatible with the PyObjC version you are installing.
fix
Upgrade your Python environment to Python 3.10 or later for PyObjC 12.x (including this package). Always check `requires_python` on PyPI or the PyObjC changelog for specific version requirements.
affects: >=11.0
breakingPyObjC 11.1 changed how initializer methods (`init` family) are modeled, now correctly reflecting that they 'steal' a reference to `self` and return a new one, as per clang's ARC documentation. This affects object lifecycle and reference counting.
fix
Review code that interacts with object initialization, especially custom subclasses or factory methods, to ensure correct reference handling. Explicit memory management is rarely needed in Python, but understanding the underlying Objective-C semantics is crucial for correct behavior.
affects: >=11.1
gotchaPyObjC is a macOS-specific library and will not install or run on other operating systems. The frameworks it wraps (like PencilKit) are Apple-proprietary.
fix
Only use `pyobjc-framework-pencilkit` in macOS environments. For cross-platform drawing or GUI development, consider alternative libraries.
affects: all
gotchaUnlike Objective-C, where sending a message to `nil` (equivalent to Python `None`) is a no-op, attempting to call a method on a Python `None` object (which PyObjC translates from `nil`) will raise an `AttributeError`.
fix
Always check for `None` before calling methods on PyObjC-wrapped objects that might originate from Objective-C `nil` values. E.g., `if my_obj is not None: my_obj.doSomething_()`.
affects: all
gotchaKey-Value Observing (KVO) is not supported for pure Python objects. If you need KVO compatibility for properties of Python objects, they must inherit from `NSObject`. For observable sequence or dictionary instance variables, use `NSMutableArray` or `NSMutableDictionary` instead of Python lists or dictionaries.
fix
Ensure custom classes requiring KVO inherit from `AppKit.NSObject` or `Foundation.NSObject`. Use `Foundation.NSMutableArray` and `Foundation.NSMutableDictionary` for collections that will be observed.
affects: all
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredCore bridge functionality for PyObjC frameworks.
pyobjc-framework-CocoarequiredProvides core macOS GUI frameworks like AppKit and Foundation, necessary for most PyObjC applications and PencilKit UI integration.
Agent activity
4 hits · last 30 days
node
4
Resources
pyobjc-framework-pencilkit — pip install pyobjc-framework-pencilkit · libregistry