import turtle
def drawPolygon(t, sideLength, numSides):
turnAngle = 360 / numSides
for i in range(numSides):
t.forward(sideLength)
t.right(turnAngle)
def drawCircle(anyTurtle, radius):
circumference = 10 * 3.1415 * radius
sideLength = circumference / 360
drawPolygon(anyTurtle, sideLength, 360)
wn = turtle.Screen()
wheel = turtle.Turtle()
turtle.pen(fillcolor="black", pencolor="red", pensize=10)
drawCircle(wheel, 20)
turtle.fillcolor('red')
wn.exitonclick()
def drawPolygon(t, sideLength, numSides):
turnAngle = 360 / numSides
for i in range(numSides):
t.forward(sideLength)
t.right(turnAngle)
def drawCircle(anyTurtle, radius):
circumference = 10 * 3.1415 * radius
sideLength = circumference / 360
drawPolygon(anyTurtle, sideLength, 360)
wn = turtle.Screen()
wheel = turtle.Turtle()
turtle.pen(fillcolor="black", pencolor="red", pensize=10)
drawCircle(wheel, 20)
turtle.fillcolor('red')
wn.exitonclick()
No comments:
Post a Comment