""" Authors: Sohie Lee, Peter Mawhorter Consulted: Date: 2021-9-8 Purpose: SOLUTION for Lab01 turtle drawing smiley face exercise """ # Note: default screen size is 700x650 from turtle import * from turtleBeads import * # This function lives in the turtleBeads.py file, we call it # here to set up the canvas for turtle drawings setupTurtle() noTrace() # Adds a title to the turtle canvas title("Look what I made!") # Background color bgcolor("gray40") # Building the scene from the background to the foreground since the most # recently added objects appear in front of those already existing # Draw the head shape pensize(5) pencolor("bisque") fillcolor( "tan3") teleport(0,0) # at center by default begin_fill() drawCircle(250) # circular head # Other reasonable head shapes # drawRectangle(300, 450) reasonable blockhead # drawEllipse(300, 0.75) egg shaped vertical head #drawPolygon(150, 8) #sidelen, numsides stop-sign head end_fill() # Draw eyes # left eye pensize(3) pencolor('black') fillcolor('cyan') teleport(-90, 60) begin_fill() drawEllipse(30, 2.5) end_fill() # right eye pensize(10) pencolor('black') fillcolor('steelblue4') teleport(90, 70) begin_fill() drawEllipse(35, 1.25) end_fill() # Draw the mouth as two overlapping circles # This is the bottom circle pencolor('red') fillcolor('red') teleport(0,-90) begin_fill() drawCircle(90) end_fill() # This is the top circle, matching the face color to blend teleport(0,-60) pencolor('tan3') fillcolor('tan3') # match background color of face begin_fill() drawCircle(100) end_fill() # Small circular nose pensize(5) pencolor('orange') fillcolor('orange') teleport(0,0) drawDot(50) # # Two options for hair # # Option 1: hair in two pieces # # Left hair # pensize(3) # pencolor('aquamarine4') # fillcolor('aquamarine4') # teleport(-40, 190) # begin_fill() # lt(8) # drawEllipse(45,4) # rt(8) # end_fill() # # # Right hair # teleport(80,180) # begin_fill() # rt(15) # drawEllipse(35,4.5) # lt(15) # end_fill() # # Option 2: curly ringlets framing the face pensize(10) pencolor('pink') fillcolor('pink') teleport(-40, 220) begin_fill() drawCircle(50) end_fill() teleport(-130, 180) begin_fill() drawCircle(55) end_fill() teleport(-200, 150) begin_fill() drawCircle(58) end_fill() teleport(-235, 110) begin_fill() drawCircle(56) end_fill() teleport(-260, 50) begin_fill() drawCircle(59) end_fill() teleport(-262, -10) begin_fill() drawCircle(65) end_fill() teleport(40, 220) begin_fill() drawCircle(50) end_fill() teleport(130, 180) begin_fill() drawCircle(55) end_fill() teleport(200, 150) begin_fill() drawCircle(58) end_fill() teleport(235, 110) begin_fill() drawCircle(56) end_fill() teleport(260, 50) begin_fill() drawCircle(59) end_fill() teleport(262, -10) begin_fill() drawCircle(65) end_fill() teleport(270, -50) begin_fill() drawCircle(65) end_fill() teleport(-270, -50) begin_fill() drawCircle(65) end_fill() # end the curly hair ringlets # Hat options # -------------- # Option 1: boxy hat at a slight angle # pensize(5) # pencolor('navy') # fillcolor('navy') # teleport(30,220) # rt(5) # begin_fill() # drawRectangle(400,40) # end_fill() # teleport(30,260) # begin_fill() # drawRectangle(200,120) # end_fill() # lt(5) # # # # flower on hat # pensize(2) # fillcolor('bisque') # teleport(80,270) # begin_fill() # drawEllipse(10, 3.5) # lt(60) # drawEllipse(10, 3.5) # lt(60) # drawEllipse(10, 3.5) # end_fill() # Hat option 2: pom pom triangular hat pensize(8) pencolor('darkslategray4') fillcolor('darkslategray1') teleport(-165, 190) begin_fill() lt(30) # facing almost north fd(240) lt(105) bk(230) lt(38) fd(370) rt(173) # back facing east end_fill() # pompom on top of the triangular hat # pompom is made of 3 overlapping filled ellipses, # each one rotated 60 degrees from the previous one pensize(2) pencolor('darkslategray4') fillcolor('darkslategray4') teleport(40, 305) begin_fill() drawEllipse(10, 3.5) lt(60) drawEllipse(10, 3.5) lt(60) drawEllipse(10, 3.5) end_fill() # Writing text, centered at the bottom of the canvas below the face # pencolor fillcolor pencolor('white') fillcolor('black') teleport(-200,-270) fontsize(24) drawText('I love cs111') showPicture() ''' Note: here is how to get available fonts: from tkinter import Tk, font root = Tk() font.families() '''