Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/taturtle.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/taturtle.py')
-rw-r--r--TurtleArt/taturtle.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py
index 1f616c0..68b97cc 100644
--- a/TurtleArt/taturtle.py
+++ b/TurtleArt/taturtle.py
@@ -34,6 +34,7 @@ from tacanvas import wrap100, COLOR_TABLE
from sprites import Sprite
from tautils import (debug_output, data_to_string, round_int, get_path,
image_to_base64)
+from TurtleArt.talogo import logoerror
SHAPES = 36
DEGTOR = pi / 180.
@@ -151,13 +152,34 @@ class Turtles:
self._active_turtle.hide()
self.set_turtle(self._default_turtle_name)
+ def get_turtle_x(self, turtle_name):
+ if turtle_name not in self.dict:
+ debug_output('%s not found in turtle dictionary' % (turtle_name),
+ self.turtle_window.running_sugar)
+ raise logoerror("#syntaxerror")
+ return self.dict[turtle_name].get_x()
+
+ def get_turtle_y(self, turtle_name):
+ if turtle_name not in self.dict:
+ debug_output('%s not found in turtle dictionary' % (turtle_name),
+ self.turtle_window.running_sugar)
+ raise logoerror("#syntaxerror")
+ return self.dict[turtle_name].get_y()
+
+ def get_turtle_heading(self, turtle_name):
+ if turtle_name not in self.dict:
+ debug_output('%s not found in turtle dictionary' % (turtle_name),
+ self.turtle_window.running_sugar)
+ raise logoerror("#syntaxerror")
+ return self.dict[turtle_name].get_heading()
+
def set_turtle(self, turtle_name, colors=None):
''' Select the current turtle and associated pen status '''
if turtle_name not in self.dict:
# if it is a new turtle, start it in the center of the screen
self._active_turtle = self.get_turtle(turtle_name, True, colors)
self._active_turtle.set_heading(0.0, False)
- self._active_turtle.set_xy(0.0, 0.0, False, pendown=False)
+ self._active_turtle.set_xy(0.0, 0.0, share=False, pendown=False)
self._active_turtle.set_pen_state(True)
elif colors is not None:
self._active_turtle = self.get_turtle(turtle_name, False)
@@ -467,7 +489,7 @@ class Turtle:
self.spr.set_layer(TURTLE_LAYER)
self._hidden = False
self.move_turtle_spr((self._x, self._y))
- self.set_heading(self._heading)
+ self.set_heading(self._heading, share=False)
if self.label_block is not None:
self.label_block.spr.set_layer(TURTLE_LAYER + 1)