[Pythonmac-SIG] Porting a Tkinter application to Cocoa: question about datatypes
Kevin Walzer
kw at codebykevin.com
Thu Jun 14 02:33:00 CEST 2007
Ronald Oussoren wrote:
>
> The major exception to this is Key-Value Observing (also known as Cocoa
> bindings). Cocoa bindings requires that objects emit events when they
> are mutated (append an item, set the value for a key in a dict, ...).
> Sadly enough Python doesn't have the hooks that are required to emit
> these events for pure python objects. Adding this support requires some
> low-level changes to python and I'm not sure if this can be done without
> adversely affecting the performance of the interpreter.
Interesting. Are Cocoa bindings analogous to the updating and binding
mechanism in Tk? For instance, in Tkinter, I can assign a value to an
object, then update that value later in another function via the
StringVar() mechanism. For instance, in in my self.drawGUI function, I
can do this:
self.status = StringVar()
self.status.set('Ready')
then in another function, I can call this:
self.status.set('Process terminated')
and the value of the label widget will be updated. Was this
functionality hard to manage or missing in Objective-C/Cocoa before the
"Cocoa Binding" stuff was added?
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
More information about the Pythonmac-SIG
mailing list