'''lecture_05_my_shapes.py Oliver W. Layton CS 151 Spring 2021 Lecture 05 Collection of shapes TODO: 1. Add color to shapes, show best practice restoring at end of function. 2. Customize triangle edge/fill colors 3. Change triangle edge thickness ''' import turtle def goto(x, y): '''Send turtle to new position (x,y) without drawing anything. ''' turtle.penup() turtle.goto(x, y) turtle.pendown() def rectangle(x, y, width, height): '''Draws a rectangle at (x, y) of the given width and height. ''' goto(x, y) # turtle.color('blue', 'green') turtle.color('brown') turtle.begin_fill() turtle.forward(width) turtle.left(90) turtle.forward(height) turtle.left(90) turtle.forward(width) turtle.left(90) turtle.forward(height) turtle.left(90) turtle.end_fill() turtle.color('black') def triangle(x, y, edgeSize): ''' Draws an upright triangle''' goto(x, y) turtle.forward(edgeSize) turtle.left(120) turtle.forward(edgeSize) turtle.left(120) turtle.forward(edgeSize) turtle.left(120) # no main code!