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

Dan Williams dcbw
Wed Jul 18 12:23:26 EDT 2007


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.

Dan

> ~ Aneto
> 
> -- 
> Aneto Okonkwo
> BS Management Science & Engineering
> MA Education: Learning, Design & Technology
> Stanford University
> oaneto at stanford.edu
> 650.906.3961 (M) 
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar




More information about the Sugar-devel mailing list