[Glade-users] Change an PNG image by athother!



I hope that I understood you right, if not so please tell me more exact 
what you want:


GError *err= NULL;
// load a new image from file
// the gdk_pixbuf... functions provide also image manipulation functionality
GdkPixbuf *buf= gdk_pixbuf_new_from_file ( 
"PATH_TO_PIC/PICTURE_NAME.png", &err );

// Then you can lookup the glade generated image name (= Widget Name
// in the glade Properties Dialog)
GtkWidget *widget= lookup_widget (dialog, "WIDGET_NAME");
// now set the new loaded image instead of the old image:
gtk_image_set_from_pixbuf( GTK_IMAGE( widget ), buf);
// do not forget to unref your pic (so that the memory is freed)
gdk_pixbuf_unref( buf );

Tino!

JOSE PEDRO SERGIO ROMAO MACHADO wrote:

Hi there!

I want to create an "semaphore" in my program, using a green and a red 
PNG images!

I want to place an green PNG image and change it by another one, a red 
one.

The problem is that, I build my GUI with glade, and I can't find a way 
to load another image in the same spot as the other image...

Any sugestions?!

Thanks in Advance


+-----------------------------------+
|    Jos� Pedro S. Rom�o Machado    |
|       (DET/LEET - N�15993)        |
+-----------------------------------+
|      Universidade de Aveiro       |
| Dep. de Elect. e Telecomunica��es |
|           (www.ua.pt)             |
+-----------------------------------+
_______________________________________________
Glade-users maillist  -  Glade-users lists ximian com
http://lists.ximian.com/mailman/listinfo/glade-users





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]