GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Aug 21, 2014 8:13 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 
Offline

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.


Code:

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), 
                                                      appState->image);
 
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);
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 22, 2007 6:46 pm 
Offline
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?


Top
 Profile  
 
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 6 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