Re: Writing science application to visualisate physical process. Need help.
- From: Peter Volkov Alexandrovich <gentoo_ml mail ru>
- To: Jan-Marek Glogowski <glogow fbihome de>
- Cc: gtk-list gnome org
- Subject: Re: Writing science application to visualisate physical process. Need help.
- Date: Tue, 22 Jun 2004 07:52:19 +0000
Hi!
Now I've got moving rectangular! But some comments are still nessesary.
В сообщении от 20 Июнь 2004 22:57 вы написали:
> If you want to use static images and want to move them, look at the
> gdk-pixbuf API. For an examples see the gtk+ source (demos/gtk-demo).
>
> GtkImage should be used for static images, GtkDrawingArea for dynamic ones
> (like your movie).
So drawing area is my choice. I really need some dynamics.
> gboolean my_idle( gpointer data )
> {
> if( pixmap == NULL )
> return TRUE;
>
> // Your drawing here
>
> gtk_widget_queue_draw_area(...);
> return TRUE;
> }
>
> void main(...)
> {
> ...
>
> g_idle_add( my_idle );
> gtk_main();
> }
Well. I understand. But is the return value of my_idle function the only
mechanism to stop calling it? Can I set some timer to call idle function one
time per call_period?
> P.S. In your code it may be enought to add
>
> while (gtk_events_pending ())
> gtk_main_iteration ();
>
> after the gtk_widget_queue_draw_area, so Gtk+ can process the drawing
> request - that's just a guess
Yes this works. Thank you very much! This really helped. For now I can
program, but Are there better ways to do such drawings?
Just to understand what I am doing: The gdk_draw function used instead of
gtk_* because the drawing area is the X window. And so we need some X lib
functions (gdk wrapers) to draw on it. Am I right?
Thank you in advance,
___________________
Peter.
P.S. Is this mailing list the right place for questions about gtk+
programming, or there are better lists to ask? Sorry If I was wrong.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]