Ionutz Borcoman wrote:

Hi,

In the reference of PyGTK http://www.moeraki.com/pygtkreference/pygtk2reference/index.html
it is stated that certain attributes are read/write attributes.

The reference you probably used is the gtk.Container:


http://www.pygtk.org/pygtk2reference/class-gtkcontainer.html


However, trying to do something like:


box.border = 5

doesn't work. But:
box.set_border_width(5)


works.

Why can't I simply use the first construct ?

PyGTK supports both properties (part of GTK) and attributes (PyGTK only). Properties are set using the GObject set_properties() method:


http://www.pygtk.org/pygtk2reference/class-gobject.html#method-gobject--set-property

while attributes are accessed using the Python object attribute dot operator: e.g object.attribute

The confusion here is that the "border_width" property is read/write but the border_width attribute is read-only.

Hope this helps,

John

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to