From 7f731457c2b20bbfb37b78d4da6db55cb62d56b5 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 4 Nov 2007 17:16:16 +0100 Subject: [PATCH] Wrap the canvas inside a gtk.EventBox to make it easier to take screenshot of the canvas area only. --- lib/sugar/graphics/window.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/sugar/graphics/window.py b/lib/sugar/graphics/window.py index 003f870f..3b3394a9 100644 --- a/lib/sugar/graphics/window.py +++ b/lib/sugar/graphics/window.py @@ -34,15 +34,20 @@ class Window(gtk.Window): self._hbox = gtk.HBox() self._vbox.pack_start(self._hbox) self._hbox.show() + + self._event_box = gtk.EventBox() + self._hbox.pack_start(self._event_box) + self._event_box.show() self.add(self._vbox) self._vbox.show() def set_canvas(self, canvas): if self.canvas: - self._hbox.remove(self.canvas) + self._event_box.remove(self.canvas) - self._hbox.pack_start(canvas) + if canvas: + self._event_box.add(canvas) self.canvas = canvas