Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tacanvas.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-01-27 23:08:43 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-01-27 23:08:43 (GMT)
commit8ff521173bcb6eb073c8413d62a570189ce40d3f (patch)
tree847520448abda6732aab5e5dc9d9fc53f51fde30 /tacanvas.py
parent8ee1d89d6fa222fbd0f7ed0ab75b2a65103a350c (diff)
*turtle imporvements
Diffstat (limited to 'tacanvas.py')
-rw-r--r--tacanvas.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/tacanvas.py b/tacanvas.py
index bf81876..e283f5a 100644
--- a/tacanvas.py
+++ b/tacanvas.py
@@ -97,6 +97,7 @@ class TurtleGraphics:
self.xcor, self.ycor, self.heading = 0, 0, 0
self.move_turtle()
self.turn_turtle()
+ self.tw.turtle_list.show_all()
def forward(self, n):
n *= self.tw.coord_scale
@@ -192,6 +193,7 @@ class TurtleGraphics:
self.pensize = ps
except:
pass
+ self.tw.turtle.set_pen_size(ps)
self.gc.set_line_attributes(int(self.pensize*self.tw.coord_scale),
gtk.gdk.LINE_SOLID, gtk.gdk.CAP_ROUND, gtk.gdk.JOIN_MITER)
@@ -201,6 +203,7 @@ class TurtleGraphics:
self.tcolor = c
except:
pass
+ self.tw.turtle.set_color(c)
self.set_fgcolor()
self.set_textcolor()
@@ -222,6 +225,7 @@ class TurtleGraphics:
self.shade = s
except:
pass
+ self.tw.turtle.set_shade(s)
self.set_fgcolor()
self.set_textcolor()
@@ -297,7 +301,7 @@ class TurtleGraphics:
h+self.pensize*self.tw.coord_scale+6)
def turn_turtle(self):
- self.tw.turtle.rotate(self.heading)
+ self.tw.turtle.set_heading(self.heading)
def move_turtle(self):
x, y = self.width/2+int(self.xcor), self.height/2-int(self.ycor)
@@ -309,20 +313,24 @@ class TurtleGraphics:
self.tw.area.invalidate_rect(rect, False)
def set_turtle(self, i):
- # TODO: associate pen state with individual turtles
+ # TODO: associate pen up/down state with individual turtles
# TODO: reskin active turtle
print "switching to Turtle %d" % (i)
if i > self.tw.turtle_list.turtle_count()-1:
- # if it is a new turtle, put it in the center of the screen
+ # if it is a new turtle, start it in the center of the screen
self.tw.turtle = self.tw.turtle_list.get_turtle(i, True)
self.xcor = 0
self.ycor = 0
self.heading = 0
- self.tw.turtle.move_turtle()
- self.tw.turtle.rotate(self.heading)
+ self.move_turtle()
+ self.turn_turtle()
self.tw.turtle = self.tw.turtle_list.get_turtle(i, True)
tx, ty = self.tw.turtle.get_xy()
self.xcor = tx+30-self.width/2
self.ycor = self.height/2-ty-30
self.heading = self.tw.turtle.get_heading()
+ self.setcolor(self.tw.turtle.get_color())
+ self.setshade(self.tw.turtle.get_shade())
+ self.setpensize(self.tw.turtle.get_pen_size())
self.tw.turtle_list.show_all()
+