Re: How can i show a GtkImage widget ?



chao yeaj wrote:
Hello,everyone

         I have GtkWidget like this:

      GtkWidget *image = gtk_image_new_from_file("~/image.jpg");

     and i show that widget like this:
           GtkWidget *frame = gtk_frame_new(NULL);
          gtk_container_add(GTK_CONTAINER(frame),image);
       gtk_show_widget_all(frame);


        But ,the problem is,I can not see the image in my application

       Why ?
Any  comments would be much appreciated,and thanks in advance !!

  
Because most likely there is no sub-directory called "~" in the current
path.

~ to mean the user's home directory is a shell feature. GTK does not
support it (well, not directly. But there might be some glib function
that helps.) You have to use explicit paths. If you want the user's home
directory, glib can help you with that.


-- 
<Knghtbrd> joeyh now has a terminal at the couch?
<Knghtbrd> That guy is wired, I swear  =>
<doogie> Knghtbrd: laptop
<doogie> and I don't mean the cats.

Eduardo M KALINOWSKI
ekalin bol com br
http://move.to/hpkb




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