[Edu-sig] odd drawing problem with turtle.py
Vern Ceder
vceder at canterburyschool.org
Mon Feb 1 05:07:44 CET 2010
kirby urner wrote:
> I don't see where you've defined a Turtle class to instantiate sir.
The Turtle class is part of the turtle library, so that's not an issue.
> On Sun, Jan 31, 2010 at 4:27 PM, Brian Blais <bblais at bryant.edu> wrote:
>> I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 - 24. 9.
>> 2009. The following script draws 5 circles, which it is supposed to, but
>> then doesn't draw the second turtle which is supposed to simply move
>> forward. Any ideas?
You mean you just want a turtle, but no line? If so, does instantiating
T with T = Turtle(visible=True) help?
Cheers,
Vern
>> from turtle import *
>> from numpy.random import randint
>> resetscreen()
>> class Circle(object):
>> def __init__(self,x,y,r,color):
>> self.x=x
>> self.y=y
>> self.r=r
>> self.color=color
>>
>> self.turtle=Turtle(visible=False)
>> self.turtle.tracer(False)
>> self.draw()
>>
>> def draw(self):
>> self.turtle.penup()
>> self.turtle.setposition(self.x,self.y)
>> self.turtle.setheading(0)
>> self.turtle.backward(self.r)
>> self.turtle.pendown()
>> self.turtle.fill(True)
>> self.turtle.pencolor("black")
>> self.turtle.fillcolor(self.color)
>> self.turtle.circle(self.r)
>> self.turtle.fill(False)
>> self.turtle.penup()
>>
>> for i in range(5):
>> c=Circle(randint(-350,350),randint(-250,250),10,"red")
>>
>>
>> T=Turtle()
>> T.forward(100)
>> T.forward(100)
>>
>>
>>
>>
>>
>>
>>
>> thanks,
>>
>> bb
>> --
>> Brian Blais
>> bblais at bryant.edu
>> http://web.bryant.edu/~bblais
>> http://bblais.blogspot.com/
>>
>>
>>
>> _______________________________________________
>> Edu-sig mailing list
>> Edu-sig at python.org
>> http://mail.python.org/mailman/listinfo/edu-sig
>>
>>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
--
This time for sure!
-Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137
The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW
More information about the Edu-sig
mailing list