[gtkmm] Design quetstion



This is not strictly a gtkmm question, but I'm sure someone will know how
to do this.

I need to build a gui for a program that updates a spline (in some
meaningful way), iteratively. Right now I run the spline program at the
prompt, and I save the spline to a file every 50 iterations.

Instead of that, I want to display the updated spline and I don't want to
see the old updates, just the current one. It must look like a moving
snake. Also, the algorithm must be started/stopped from a toggle button.
What is the general plan for that?

I'm thinking:

1) create a separate thread for the start/stop requirement. The spline
loop should have a "stopped" flag, which is set by the "stop" button. Is
that right?

2) Display the spline in a drawing area. How do I do the display though?
Do I use a timer which calls a display callback every 20ms, say,
independently of the spline loop? Or do I tell my spline program about gtk
and drawing area, and make it draw the current spline every so many
iterations? I would rather keep the spline code separated from the gui.

Thanks for any advice!

Silviu Minut





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