On Wed, 17 Nov 2004 21:30:16 +0100 Gian Mario Tagliaretti
<[EMAIL PROTECTED]> wrote:
> On Wednesday 17 November 2004 21:05, Christian Robottom Reis wrote:
> I would like to understand why... can you (or someone) please explain
> it? I will offer a few glass of the above mentioned :)
>>> img = gtk.Image()
>>> retval = img.set_from_stock(gtk.STOCK_DIALOG_INFO,
>gtk.ICON_SIZE_BUTTON)>> img
<gtk.Image object (GtkImage) at 0x401e00f4>
>>> retval
>>>
>>> img.get_stock()
('gtk-dialog-info', <enum GTK_ICON_SIZE_BUTTON of type GtkIconSize>)
Again, gtk.Image() creates a new instance of the image class.
the method set_from_stock(...) alters the Image class (as you can see by
calling img.get_stock()).
It wouldn't make sense for the set_stock method to return anything. If I
recall correctly, python generally has functions either return a value
OR modify an object. If they modify, they don't return anything, so as
to avoid confusion.
For example...
>>> a = [1,2,3]
>>> b = [2,3,4]
>>> a + b
[1, 2, 3, 2, 3, 4]
>>> a
[1, 2, 3]
>>> b
[2, 3, 4]
a + b returns a value; neither a nor b is modified.
>>> a.extend(b)
>>> a
[1, 2, 3, 2, 3, 4]
extend() doesn't return a value, because a is modified.
Tom
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/