diff options
Diffstat (limited to 'abacus_window.py')
-rw-r--r-- | abacus_window.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/abacus_window.py b/abacus_window.py index 9be9b89..b340a8f 100644 --- a/abacus_window.py +++ b/abacus_window.py @@ -857,9 +857,23 @@ class Abacus(): def _expose_cb(self, win, event): ''' Callback to handle window expose events ''' - self.sprites.redraw_sprites(event.area) + self.do_expose_event(event) return True + # Handle the expose-event by drawing + def do_expose_event(self, event): + + # Create the cairo context + cr = self.canvas.window.cairo_create() + + # Restrict Cairo to the exposed area; avoid extra work + cr.rectangle(event.area.x, event.area.y, + event.area.width, event.area.height) + cr.clip() + + # Refresh sprite list + self.sprites.redraw_sprites(cr=cr) + def _destroy_cb(self, win, event): ''' Callback to handle quit ''' gtk.main_quit() |