Loop the loop art (Python)

vegaseat 1 Tallied Votes 398 Views Share

Python module turtle makes it simple to draw graphics art similar to art done by the Logo language.

''' turtle_loop_art101.py
using Python module turtle to draw circles in loop the loop fashion
tested with Python27 and Python33  by  vegaseat  17oct2013
'''

import turtle as tu

def draw_loop(loops, size):
    '''draw a circle/loop'''
    for k in range(loops):
        tu.right(360.0/loops)
        tu.forward(size)

def start_draw(loops, size):
    '''positions loops'''
    for k in range(loops):
        tu.right(360.0/loops)
        draw_loop(loops, size)
        

tu.title("fun with loops/circles")

tu.hideturtle()
tu.bgcolor("blue")
tu.pencolor("yellow")
tu.pensize(2)

tu.speed('fastest')
# comment out tracer() for set turtle speeds
tu.tracer(36, 0)

loops = 36
size = 24
start_draw(loops, size)

# wait till corner x is clicked
tu.done()