Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/taturtle.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-02-03 19:16:53 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-02-03 19:16:53 (GMT)
commit96b6b6a92bb1021dd4a818a76e1c59af6d682b74 (patch)
tree3b6b2f5ece8f2b8b384b2d380caf4eeafc8d223b /taturtle.py
parent195b840e6feca6089768941a694ec9832f509006 (diff)
saving/restoring multiple turtles; fixed turtle selection bug
Diffstat (limited to 'taturtle.py')
-rw-r--r--taturtle.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/taturtle.py b/taturtle.py
index acf051e..9170413 100644
--- a/taturtle.py
+++ b/taturtle.py
@@ -47,6 +47,9 @@ class Turtles:
else:
return(self.list[i])
+ def get_turtle_index(self, turtle):
+ return(self.list.index(turtle))
+
def turtle_count(self):
return(len(self.list))
@@ -110,13 +113,12 @@ class Turtle:
def set_heading(self, heading):
self.heading = heading
i = (int(self.heading+5)%360)/10
- try:
- if self.hidden is False:
+ if self.hidden is False:
+ try:
self.spr.set_shape(self.shapes[i])
- except IndexError:
- if self.hidden is False:
+ except IndexError:
self.spr.set_shape(self.shapes[0])
- print "Turtle shape IndexError %f -> %d" % (heading, i)
+ print "Turtle shape IndexError %f -> %d" % (heading, i)
def set_color(self, color):
self.pen_color = color