[Glade-users] Glad + pixbuf problem

Damon Chaplin damon@karuna.uklinux.net
Thu, 13 Mar 2003 21:02:05 +0000


On Thu, 2003-03-06 at 18:51, John Coppens wrote:
 > Not a programming genius to begin with, I'm stuck trying to get an image
 > loaded into a drawable, using Glade and GTK 1.2xx!
 >
 > I'm trying to load a .jpeg onto a gnome_canvas... All the rest works - I
 > can show any gnome_canvas_item, without problem, but there seems to be a
 > problem with the image.
 >
 > I load the image with gdk_pixbuf_new_from_file, no errors.
 > I then call gnome_canvas_set_scroll_region, which works, as the 
scrollbars
 > appear to show that the size I asked for is larger than the screen size.
 >
 > Then I try to show it with:
 >
 >   map = gnome_canvas_item_new(grp,
 >     gnome_canvas_image_get_type(),
 >     "pixbuf", myImage,
 >     "x", 0.0, "y", 0.0, "width", 800.0, "height", 400.0,
 >     "anchor", GTK_ANCHOR_CENTER, NULL);
 >   gdk_pixbuf_unref(myImage);
 >
 > Which has no effect at all.
 >
 > I suspect that there may be some compatibility problem with
 > 'gnome_canvas_image_get_type' and 'pixbuf'. I'm not sure where the 
problem
 > lies though.

You may just need to do a gnome_canvas_item_show() on it.
I've often had silly problems like that with GnomeCanvas.

Damon