Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/taturtle.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-10-07 17:47:27 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-10-07 17:47:27 (GMT)
commit9a72bd2af36099323c245a066d13b6464d795a32 (patch)
treee45606717ed7626fc5b821c7712e9385d4931216 /TurtleArt/taturtle.py
parent74c3f5ddc3ff238aab3728dac4cc65901dbba664 (diff)
add support for querying remote turtle position, heading
Diffstat (limited to 'TurtleArt/taturtle.py')
-rw-r--r--TurtleArt/taturtle.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py
index 5e24ce7..b87d0a6 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,6 +152,27 @@ 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: