def triangles(side=100, step=20, n=10): t = Turtle('triangles') d = 300 for i in xrange(n): side += (3*step) t.polygon(3, side) t.right(120) t.pen_up() t.forward(step) t.left(120) t.back(step) t.pen_down() t.save()
turtle = Turtle('pentagram_rel') turtle.right(90 / 5) for i in range(5): turtle.right(360 / 5) turtle.forward(dist) turtle.right(90 + 90 / 5) for i in range(5): turtle.right((180 - (360 / 5)) / 3) if i % 2 == 0: turtle.forward(dist * golden_ratio) else: turtle.back(dist * golden_ratio) turtle.save() #################### pentagram absolute import svgwrite from math import sin, sqrt, tan, cos, pi def render(lines): dwg = svgwrite.Drawing('pentagram_abs.svg', profile='tiny') stroke = svgwrite.rgb(10, 10, 16, '%') for f, t in lines: dwg.add(dwg.line(f, t, stroke=stroke))