Ejemplo n.º 1
0
    angle = (n-2) * 180. / n
    k = 18
    for _ in xrange(k):
        for i in xrange(n):
            draw.forward(a)
            draw.right(180 - angle)
        draw.right(360./k)



if __name__ == "__main__":

    draw = Turtle("Various_pictures")

    draw.setCoord(10, 10)
    draw.resetDir()

    draw.penDown()
    square(draw, 200)

    draw.resetDir()
    draw.setCoord(210, 70)
    barredCircle(draw, r=50, shift=5)

    draw.setCoord(75, 200)
    triangle(draw, 10, 5, 15)

    draw.setCoord(225, 210)
    rose(draw)
Ejemplo n.º 2
0
    draw.penDown()
    angle = 180 - 360. / (2 * n)

    for i in xrange(n):
        draw.forward(a)
        draw.right(angle)
    draw.penUp()


if __name__ == "__main__":

    draw = Turtle("test_pictures")

    draw.penUp()
    draw.setCoord(-50, -50)
    draw.forward(100)
    draw.right(90)
    draw.forward(50)
    draw.left(90)

    regularPolygon(draw, 100, 5)
    draw.resetDir()
    draw.right(36)
    star(draw, 100 * (sin(108 / 360. * 2 * pi) / sin(36 / 360. * 2 * pi)), 5)

    draw.resetDir()
    draw.forward(300)
    verticies = regularPolygon(draw, 100, 5)

    for i, vortex in enumerate(verticies[:3]):