The module PyObjCTools.AppCategories defines a number of categories on classes from the AppKit framework. These categories introduce new methods that aren’t present in that framework.
To use these new methods use the following code somewhere in your program:
import PyObjCTools.AppCategories
This module defines a method for NSGraphicsContext:
This is a Python context-manager for use with the with statement.
Usage:
with NSGraphicsContext.savedGraphicsState():
pass
This is equivalent to:
NSGraphicsContext.saveGraphicsState()
try:
pass
finally:
NSGraphicsContext.restoreGraphicsState()
Class NSAnimationContext can be used as the context for a with statement:
with NSAnimationContext: pass
This is equivalent to:
NSAnimationContext.beginGrouping() try: pass finally: NSAnimationContext.endGrouping()