Re: "Load image in Gtk+"



The following code should do it:

   GtkWidget *w_window, *w_vbox, *w_image;

    w_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    w_vbox = gtk_vbox_new(FALSE, FALSE);
    gtk_container_add (GTK_CONTAINER (w_window),  w_vbox);
    w_image = gtk_image_new_from_file("myfile.jpg")
    gtk_box_pack_start (GTK_BOX (w_vbox), w_image, TRUE, TRUE, 0);

If you want to modify the image you may want to load it into a
GdkPixbuf and then use gtk_image_set_pixbuf() to change the image
displayed by the GtkImage.

Note that if you want to zoom the image you may want to have a look at
my GtkImageViewer widget. See
http://giv.sourceforge.net/gtk-image-viewer/ .

Hope this helps.

Regards,
Dov

On 4/30/06, azam zare <zare10954 yahoo com> wrote:
    Hello
     I start learning Gtk+ newly and for a programm i need to load image  on
to
     vbox widget.
     I read some books and serach in the internet  but these works can not
help            me        completly. i undrestand that i can use GtkImage or
Gtkpreview or
    Gdkpixmap. but i do not know how and which widget should be used .
format of    the imaage is jpeg .
     please  help me by examples quickly.
 Thank You


 ________________________________
Get amazing travel prices for air and hotel in one click on Yahoo! FareChase


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list






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