GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Aug 29, 2016 8:49 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Pixbuf / Image Problems
PostPosted: Tue Nov 20, 2007 3:04 am 

Joined: Sun Oct 21, 2007 3:20 pm
Posts: 3
The following is a segment of code that is apparently not working properly. When the program is run, no error messages appear on the console so the image file is being loaded ok, but I don't see the image in the window.
The program is set up such that the image loaded from a pixbuf is inside an event box, which is inside a vbox, which is inside a window.

Is there something wrong with the following code that I am not seeing or any suggestions on what may be happening? Thanks.


appState->event_box = gtk_event_box_new ();
pixbuf = gdk_pixbuf_new_from_file  ("5.jpg", &error );
appState->image = gtk_image_new_from_pixbuf (pixbuf);

gtk_container_add (GTK_CONTAINER (appState->event_box), 
gtk_widget_set_size_request ( GTK_WIDGET (appState->event_box),     
                          appState->imageWidth, appState->imageHeight);

gtk_window_resize ( GTK_WINDOW ( appState->window ),  appState->imageWidth + 20, appState->imageHeight + 80);

gtk_widget_show (appState->event_box);

 Post subject:
PostPosted: Thu Nov 22, 2007 6:46 pm 
Familiar Face

Joined: Sat Nov 17, 2007 3:05 pm
Posts: 5
I copied the code and it displays the picture, so I don't think there's anything wrong in the fragment you show. You don't show where you add the event box into the window, and you don't show how you're setting up the appState structure -do you actually define a structure somewhere that appState is pointing at?

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group