[Glade-users] gtk_image......... Change image on existing window
- From: c.morey48 at hotmail.com (carl morey)
- Subject: [Glade-users] gtk_image......... Change image on existing window
- Date: Tue, 14 Jul 2009 06:26:05 +0930
I have written a small program in C++ which produces images for a game.
I compile the code to a dll so that I can use the api's and images in visual basic.
I like using the picture box features of VB.net.
When the window is displayed I just:
Private Sub updateimage()
Dim st As Stream = File.Open("copy.bmp", FileMode.Open, FileAccess.Read)
PictureBox1.Image = Image.FromStream(st)
st.Dispose()
End Sub
Any time I wont a new image to appear in the existing window. It works instantly with no apparent flicker.
I have started using Fedora 10 and I would like to run my program on this OS.
Using glade I can setup a window with an image and:
eventbox1 = gtk_event_box_new ();
gtk_widget_show (eventbox1);
gtk_container_add (GTK_CONTAINER (window1), eventbox1);
image1 = gtk_image_new_from_file("copy.bmp");
gtk_widget_show (image1);
gtk_container_add (GTK_CONTAINER (eventbox1), image1);
gtk_widget_set_size_request (image1, 573, 598);
Displays the image on the window no problems...Now I want to change the image from a new file.
In a button click event I try:
image1 = gtk_image_new_from_file("copy.bmp");
gtk_widget_show (image1); ...............No sign of any new image.
and I try:
gtk_widget_destroy (image1);
first and the create the event box and image widget from scratch..........No sign of any new image.
It's like the image is frozen to the first window and cant be changed only destroyed.
I finally got it all to work by:
gtk_widget_destroy (window1);
first and then create the window , eventbox and image widget from scratch.
However there is a very large flick on and off as destroy and create works.
I must be missing something. Could someone help?
_________________________________________________________________
View photos of singles in your area Click Here
http://dating.ninemsn.com.au/search/search.aspx?exec=go&tp=q&gc=2&tr=1&lage=18&uage=55&cl=14&sl=0&dist=50&po=1&do=2&trackingid=1046138&r2s=1&_t=773166090&_r=WLM_EndText
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20090714/85b69f35/attachment-0001.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]