Ryan said:
But I don't want to argue this point, just state that this isn't the problem
I want to solve. I really liked the idea of KVO/KVC in Cocoa that James
Stroud mentioned. That is what I am after, or something like that. If there
isn't anything like that, I think that it might be worthwhile to port it to
Python in some form. It seems at first glance that it would be fairly easy to
do.
I must admit I don't know the KVO/KVC in Cocoa so I had to look it up.
It seems they are accessing widget property values through text strings
called 'key values'.
In Python we have dictionaries, and dictionaries have 'keys' and
'values'. So it should be trvial to make a system where widget
attribute values gets stored in a dictionary. One would just have to
subclass the Python dictionary in order to send an update signal
whenever an item is written to.
In PyGTK we can create and access a label (static text) like this:
label = gtk.Label(str)
label.set_text(str)
str = label.get_text()
With 'KVC' (key value controller) design it could perhaps be changed
to:
label = gtk.Label(str)
label['text'] = str
str = label['text']
It does not save any lines of code. But it adds the possibility of
checking if a widget has an attribute through the 'in' operator. E.g.
to make everything red,
for widget in wigets:
if 'color' in widget:
widget['color'] = 0xFF0000
I am not sure how useful this would be.
Then there are 'properties', as one can find in Hejlsberg's creations
Delphi and C#. This is possible too, using Python properties, which is
merely a copy of Delphi properties. Then would have something like
label.text = str
str = labe.text
Still the amount of code remains the same. But perhaps the property
solution is the more readable. I don't know. I guess it is a matter of
taste.
http://developer.apple.com/document...ding/index.html#//apple_ref/doc/uid/10000107i
http://developer.apple.com/document...l/CocoaBindings/Concepts/WhatAreBindings.html
I don't use Wimp. These days, GTK looks good on Windows without Wimp.
But yes, GTK apps do get their own 'personality' (aka look and feel).
But so does many Windows applications. Microsoft Office has it's own
widget set, so does Mozilla, SPSS, LabView, Matlab, Internet Explorer,
etc. There is really not a consistent widget set, not even on Windows.
MFC/ATL/WTL use Windows GDI controls, C# use .NET/GDI+ controls, .NET
2.0 has controls slightly different from those in .NET 1.1 (e.g. menus
and toolbars), Visual Basic 6 had ActiveX controls that were similar
but not identical to GDI controls, Delphi (VCL) has its own controls,
so does Qt and FOX. The GUI consistency on Windows is an illusion. I am
not worried about the minor differences between GTK and GDI as long as
my program looks good.