Hi all,
I'm a novice in gtk+ programming; I should actually use it for doing a project. My project is based on ARToolKit which is a library for building Augmented Reality (AR) applications. In short, AR is the superimposition of virtual imagery on the real world. More information on ARToolKit can be found @
http://www.hitl.washington.edu/artoolkit/. So, I have to use GTK+ as interface tool and obviously integrate the interface with ARToolKit....something really unclear to me up till now :shock:. I'll be glad if somebody could comment on this as well.
Something I want to do is to display an image in a GtkImage widget after choosing which image to display via a combo box. For testing purposes, I've used a button (i.e. click on the button & display the image).
I'm trying the following code (on the button - onclick event), but it doesn't work :( :
Code:
GtkWidget *img_objectdesign;
img_objectdesign = gtk_image_new_from_file ("filename.jpg");
gtk_widget_show(img_objectdesign);
I use Glade to design the interface and I work on Windows.
Actually I obtained the following code on the web, so I modified it as above because on the interface window I put a GtkImage widget named as "img_objectdesign":
Code:
GtkWidget *image;
image = gtk_image_new_from_file ("filename.jpg");
gtk_widget_show(image);
I don't know if I'm doing the right thing or if something is missing, but one thing is for sure is that nothing's happening!! I click on the button and no image is displayed. :(
Can't understand something: I used Glade to make the interface, hence it generated some code automatically (creates callbacks.c, interface.c, etc). In Glade you can name your widgets. My question is that can you access a widget directly in your gtk+ code??
I mean can I put something like
Code:
img_objectdesign = gtk_image_new_from_file ("filename.jpg");
directly (on a button event)?? ...and bearing to the fact that I named the GtkImage widget as "img_objectdesign" in Glade. But in doing so, I obtain compilation errors!! :(
So how do I use the widgets (name) directly in the gtk+ code??
I know I'm asking a lot of questions, but I hope you understand that I'm a beginner and many things are unclear to me unfortunately. :(
I don't even know if I'm formulating my questions well or if the questions are really questions? :?
Furthermore I'm really behind schedule in my project. Please help! :idea: