On Sun, Dec 09, 2007 at 05:05:19PM +0200, Donn wrote:
> I have a timeout calling a function that handles my animation.
> Within that I have a call to _draw():
>> def _draw():
> self.alloc = self.get_allocation()
> rect = gtk.gdk.Rectangle(self.alloc.x, self.alloc.y, self.alloc.width,
> self.alloc.height)
> self.window.invalidate_rect(rect, True)
>> This function forces an expose event which happens *at GTK's leisure*.
> (I'm open to alternate versions :) This one is monkey-copy, monkey-paste)
>> So:
> def _timer():
> doStuff()
> _draw()
> return True # spawn another timeout
>> What I want to ask is, is there a chance on slow computers that the expose
> event will take so long to actually run that it may happen out of synch? I
> need it to happen *and* finish *before* the timer loop returns.
What do you mean by "out of synch"? Why is it so urgent that the
redraw happen quickly?
> Should I putting in code like:
>> def _timer():
> doStuff()
> _draw()
> while exposing:
> pass
> return True
>> And then I set exposing to True (at the end of the actual expose handler)?
No -- invalidate_rect will generally *not* trigger the expose event
until after you return to the main loop, i.e., after your _timer
callback finishes. If you do a busy-loop like this, then not only
will you be living in a state of sin (busy-loops are bad!), but you
will never receive the expose event at all.
What are you trying to do?
-- Nathaniel