[Glade-users] images in gtk, and escape from gtk_main_loop



On Sun, 23 Sep 2001, yannis1976 wrote:

I would like to ask if there is some way so that I can have
both gtk_main_loop running and at the same time I can call the
image refresh function.

If you mean, "How can I call a function at a set interval?" then you want
to read the API help for gtk_timeout_add().  For instance, a program I
wrote at one stage uses two timeouts:

    gtk_timeout_add(INTERVAL, redraw_func, (gpointer)image1);
    gtk_timeout_add(MSGSPEED, message_func, (gpointer)image1);

The first draws an image, the second updates text in an offscreen buffer
for the first to use.

One other thing is the flickering I get when updating the image
on the window. I used glade to create the program's basis which
has a simple window and there I put an image widget.

Instead of changing the GdkImage that is used, try copying the contents of
your image into the one used by the GtkImage widget.  Also, you could try
using a GtkDrawable and copying the GdkImage captured from the camera in
an expose_event.

See http://users.bigpond.net.au/mlm/planner/ for an example of using a
GtkDrawable, in particular the files map.c and splash.c use GtkDrawable
widgets.

I do not have an example of using a GdkImage online at this stage.

-- 
bje







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