On 11/11/2011 08:25 PM, John Cheetham wrote:
I think it is a fairly common problem in GTK when doing screen updates in a
loop that they don't get updated on the screen straight away but wait for the
next main loop
To be honest, if you experience this, I think you are doing something
wrong.
A long time ago I wrote a little game in PyGTK (pytraffic) which also
used a bit of animation. I did not experience any such unpredictable
behaviour. GTK is really stable if used correctly. I was not using cairo
then (it did not exist) but from looking at the examples on the web the
same principles for doing animation still hold.
(1) All drawing should be done in the callback to an expose event.
(2) To trigger drawing generate an expose event using
gtk_widget_queue_draw_area (in PyGTK this is called invalidate_rect for
some reason).
(3) If necessary use a timer created by g_timeout_add to generate the
expose events asynchronously.