Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tawindow.py28
-rwxr-xr-xturtleart.py1
2 files changed, 28 insertions, 1 deletions
diff --git a/tawindow.py b/tawindow.py
index e5a69fd..3873042 100644
--- a/tawindow.py
+++ b/tawindow.py
@@ -334,6 +334,32 @@ class TurtleArtWindow():
self.overlay_shapes['polar'].hide()
self.polar = False
+ def update_overlay_position(self, widget, event):
+ """ Reposition the overlays when window size changes """
+ self.width = event.width
+ self.height = event.height
+ for _name in OVERLAY_SHAPES:
+ shape = self.overlay_shapes[_name]
+ showing = False
+ if shape in shape._sprites.list:
+ shape.hide()
+ showing = True
+ self.overlay_shapes[_name] = Sprite(self.sprite_list,
+ int(self.width / 2 - 600),
+ int(self.height / 2 - 450),
+ svg_str_to_pixbuf(
+ svg_from_file("%s/images/%s.svg" % (self.path, _name))))
+ if showing:
+ self.overlay_shapes[_name].set_layer(OVERLAY_LAYER)
+ else:
+ self.overlay_shapes[_name].hide()
+ self.overlay_shapes[_name].type = 'overlay'
+ self.cartesian = False
+ self.polar = False
+ self.canvas.width = self.width
+ self.canvas.height = self.height
+ self.canvas.move_turtle()
+
def hideshow_button(self):
""" Hide/show button """
if not self.hide:
@@ -2140,7 +2166,7 @@ class TurtleArtWindow():
""" Grab the current canvas and save it. """
if not self.interactive_mode:
- print name
+ # print name
save_picture(self.canvas, name[:-3] + ".png")
return
"""
diff --git a/turtleart.py b/turtleart.py
index 814a1ca..c76767d 100755
--- a/turtleart.py
+++ b/turtleart.py
@@ -231,6 +231,7 @@ class TurtleMain():
self.tw.save_folder = os.path.expanduser("~")
if not self.output_png:
+ win.connect("configure_event", self.tw.update_overlay_position)
self.tw.win = win
if self.ta_file is None:
self.tw.load_start()