Key-Value Observing and Python
Key-Value Coding and Key-Value Observing are supported by PyObjC. Key-Value
Observing is only supported for Cocoa objects though, because it is technically
impossible to generate the right events for pure python objects (such as
- _: at least not without patching the Python interpreter itself.
PyObjC will automaticly call
didChangeValueForKey: when changing the attribute of an object that is
a subclass of
NSObject. It is therefore not necessary to call those
methods in most use-cases for Key-Value Observing.
The ‘change’ dictionary for
can be changed after the method call, don’t store a reference to this dictionary
but make a copy when you want to use its contents later on.