""" turtle art toolkit is a list of additional functions that you can use to make artwork using the turtle. These functions are written in Python version 3 and use commands from the turtle library Author J Catchpole Date 26-11-2013 """ # import the turtle commands for a full list see # http://docs.python.org/3.0/library/turtle.html from turtle import * def polygon(line_length, sides, stroke_color, fill_color, stroke_thickness): color(stroke_color, fill_color) pensize(stroke_thickness) begin_fill() for i in range(0,sides): forward(line_length) left(360/sides) end_fill() def star(line_length, angle, stroke_color, fill_color, stroke_thickness): color(stroke_color, fill_color) pensize(stroke_thickness) start_point = pos() begin_fill() while True: forward(line_length) left(angle) if (abs(pos()-start_point) < 1): break end_fill() def curve(line_step, angle_step, total_angle, stroke_color, stroke_thickness): color(stroke_color) pensize(stroke_thickness) for i in range(0,total_angle,angle_step): forward(line_step) left(angle_step) # spiral: openness needs to be a number close to one # line_step and angle_step are probably best set to one def spiral(line_step, angle_step, openness, total_angle, stroke_color, stroke_thickness): color(stroke_color) pensize(stroke_thickness) for i in range(0,total_angle,angle_step): forward(int(line_step*openness**i)) left(angle_step) """" These are some sensible ways to call the functions to make shapes & patterns explore the possibilies by changing the parameters """ spiral(1, 1, 1.02, 90, "purple", 3) polygon(50, 10, "blue", "green", 4) curve(2,3,90,"black", 3) star(100, 160, "yellow", "red", 2)