Re: GtkImage problem



I'm thinking you'll want to add:

gtk_widget_show_all(window);

With that you can remove:

gtk_widget_show(image);


----- Original Message ----
From: beginner.c <beginner c gmail com>
To: gtk-app-devel-list gnome org
Sent: Sunday, May 6, 2007 6:36:32 PM
Subject: Re: GtkImage problem


You are right. Thanks for that. Everything executes without error...except,
no image is displayed. 


void create_window (GtkWidget *window, GtkWidget *image)
{
    
    GladeXML *gxml;
    
    gxml = glade_xml_new (GLADE_FILE, NULL, NULL);
    
    /* This is important */
    glade_xml_signal_autoconnect (gxml);
    window = glade_xml_get_widget (gxml, "window");
    image = glade_xml_get_widget (gxml, "image1");
}

void funcImage (GtkWidget *image)
{
    image = gtk_image_new();
    gtk_image_clear(GTK_IMAGE(image));
    gtk_image_set_from_file (GTK_IMAGE(image),
"/home/s/Pictures/space-05.jpg");
    gtk_widget_show(image);
}

int
main (int argc, char *argv[])
{
     GtkWidget *window = NULL;
    GtkWidget *image = NULL;
     

#ifdef ENABLE_NLS
    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);
#endif

    
    gtk_set_locale ();
    gtk_init (&argc, &argv);

    create_window (window,image);
    
    funcImage(image);
    //gtk_widget_show_all (window);
    gtk_main ();
    
    return 0;
}











David Nečas (Yeti)-2 wrote:

On Sun, May 06, 2007 at 04:06:11AM -0700, beginner.c wrote:

I am in fact
calling gtk_init() prior to any of these functions.

No, you don't, the call to gtk_image_new() to initialize
image

  GtkWidget *image = gtk_image_new();

is performed before any code in main().

Yeti

--
http://gwyddion.net/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



-- 
View this message in context: http://www.nabble.com/GtkImage-problem-tf3694858.html#a10350080
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.

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



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com



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