[sugar] gtk.Image vs gtk.gdk.pixbuf

Marco Pesenti Gritti mpgritti at gmail.com
Wed Jul 18 12:45:51 EDT 2007


On 7/18/07, Dan Williams <dcbw at redhat.com> wrote:
>
> On Wed, 2007-07-18 at 09:01 -0700, Aneto Okonkwo wrote:
> > Hi,
> >
> > Im a bit new to gtk and have had continuing performance issues with
> > the activity that we are working on.  I am trying to figure out which
> > uses less memory gtk.Image or gtk.gdk.pixbuf and how much of a
> > difference? I have done some tests of my own but its not clear yet.
>
> gtk.Image is a GtkWidget, which you can embed into a window and do a lot
> of other stuff with.  I can display itself onscreen.
>
> gtk.gdk.Pixbuf is not a displayable widget, it's just a backing store
> for pixel data that can be manipulated.  You can pass a GdkPixbuf to a
> GtkImage and have the image use the pixbuf as the backing buffer.
>
> So they are quite different things.  You probably only want to use a
> gtk.Image when you want to display the thing on screen in a window.
>
> > Also, how can I clear/delete/unref the image or pixbuf once I am done
> > using it?  gc.collect() doesnt seem to make an impact and I wasnt able
> > to find a clear description of the syntax for this on the net.  Thanks
>
> You could try just 'del pixbuf' but I think that has an impact on the GC
> process in python?  I must admit I'm not as knowledgable about that
> particular interaction between python GC and PyGTK as I should be.  but
> it's probably more related to general Python GC than anything else.


I think you need a del and than an explicit gc.

Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/sugar/attachments/20070718/d54c9e1b/attachment.htm 


More information about the Sugar mailing list