diff options
Diffstat (limited to 'TurtleArtActivity.py')
-rw-r--r-- | TurtleArtActivity.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index 1bc456e..b5c3b2a 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -783,10 +783,27 @@ class TurtleArtActivity(activity.Activity): return new_version + def _fixed_resize_cb(self, widget=None, rect=None): + ''' If a toolbar opens or closes, we need to resize the vbox + holding out scrolling window. ''' + self.vbox.set_size_request(rect.width, rect.height) + def _setup_scrolled_window(self): ''' Create a scrolled window to contain the turtle canvas. ''' + self.fixed = Gtk.Fixed() + self.fixed.connect('size-allocate', self._fixed_resize_cb) + self.fixed.show() + self.set_canvas(self.fixed) + + self.vbox = Gtk.VBox(False, 0) + self.vbox.set_size_request(Gdk.Screen.width(), + Gdk.Screen.height() - \ + 2 * style.GRID_CELL_SIZE) + self.fixed.put(self.vbox, 0, 0) + self.vbox.show() + self.sw = Gtk.ScrolledWindow() - self.set_canvas(self.sw) + self.vbox.pack_end(self.sw, True, True, 0) self.sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.sw.show() |