Re: Writing science application to visualisate physical process. Need help.



Hi

I think, you should to use some kind of CANVAS library that was designed exactly for functionality you described. Library has several implementations in different GUI kits (QT, Tcl/Tk, Gnome, etc). For GTK+ you could find it as libgnomecanvas. Though I never tried that package, so, probably, you would to ask how to get and install it.

Regards,
-andrew

Peter Volkov Alexandrovich wrote:

Good time of day.

I'm student and I need to write application to visualisate quantum mechanical process. So I'd like to write application where I could view some movie in dynamics. I tried to write it using GTK+-2.4.1 library, and now I am a bit frustrated.

What I've done. I've took a scribble-simple program from gtk+ 2.0 tutorial as a base, removed code that handles mouse moving and drawing and then tried to add some code that allows me to move for example rectangle. As the result for now I can't see any moving.

May be I'm very wrong, but my idea is the following. I take a pixmap and then I'll draw next frame on it and make it visible. The sequence of this frames form my movie. Next 3 functions illustrate what I'm actually doing:
gdk_draw_rectangle (pixmap, widget->style->white_gc,TRUE, update_rect.x_old,
update_rect.y_old, update_rect.width_old, update_rect.height_old);
gdk_draw_rectangle (pixmap, widget->style->black_gc,TRUE, update_rect.x_new,
update_rect.y_new, update_rect.width_new, update_rect.height_new);
gtk_widget_queue_draw_area (widget, update_rect.x, update_rect.y,
update_rect.width, update_rect.height);

As the result, my rectangular is in the last position.

I dare to ask because I think I'm thinking in the wrong direction at all. Looking throught library reference I've found another widget: GtkImage, but I don't know how to use it. And confusing usage of gtk and gdk functions. Is this write?

So. What is the right way to make moving picture using gtk+ library?
Thoughts and ideas, links, listings are very welcome.





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