[pygtk] window.invalidate_rect speed

Donn donn.ingle at gmail.com
Mon Dec 10 00:05:19 WST 2007


Hi,
 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.

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)?

\d

-- 
snappy repartee: What you'd say if you had another chance.



More information about the pygtk mailing list