Making with Code

Review: Turtle Drawing #

Welcome to Year 2 CS! We hope you’re excited for what we have planned this year πŸ˜„

Let’s review by taking it back to Turtle drawings!


[0] Set up #

Now that you’re in Year 2 you need a new unit folder.

πŸ’» Start by opening your Terminal!

πŸ’» In the Terminal, go into your making_with_code folder and create a unit03_networking folder. If you no longer have a making_with_code folder, you will need to create one.

cd ~/desktop/making_with_code
mkdir unit03_networking
cd unit03_networking

πŸ’» Then, clone your starter code. Be sure to change yourgithubusername to your actual Github username.

remember: tab autocompletes in the Terminal

git clone https://github.com/the-isf-academy/lab_turtle_review_yourgithubusername

πŸ’» cd into the lab

cd lab_turtle_review_yourgithubusername
πŸ‘Ύ πŸ’¬ Windows Users

We suggest not copying the path command, and instead using cd and ls to ensure you are in the correct making_with_code folder.

πŸ’» Install Tkinter We’ll need this for our drawings.

brew install python-tk

πŸ’» Enter the Poetry Shell. Remember, we run this command at the start of each lab, but only when we are inside a lab folder.

poetry shell
πŸ‘Ύ πŸ’¬ Exiting the poetry shell

When you want to exit the shell, you can type exit or ^D


[1] Create a Turtle Drawing #

πŸ’» Run the Python file
python turtle_drawing.py

πŸ’» Open the code. The . opens the entire folder.

code . 

πŸ’» Using the starter code in turtle_drawing.py create a drawing that includes at least 3 of CS concepts below:


A Few Helpful Functions #

  • 🌈 Explore color options here
FunctionInputExample UseExplanation
forwardamountforward(100)Moves the turtle forward by the specified amount
backwardamountbackward(100)Moves the turtle backward by the specified amount
rightangle in degreesright(45)Turns the turtle clockwise by the specified angle
leftangle in degressleft(45)Turns the turtle counter clockwise by the specified angle
colorcolornamecolor('red')Sets the color for drawing. Use “red”, “black”, etc. Here’s a list of all the colors.
speednumber from 0-10speed(0)Determines the speed at which the turtle moves around the window. 1 for slowest, 3 for normal speed, 10 for fast, 0 for fastest.
pendownNonependown()Puts down the turtle/pen so that it draws when it moves
penupNonepenup()Picks up the turtle/pen so that it doesn’t draw when it moves
pensizewidthpensize(4)Sets the width of the pen for drawing
setheadinganglesetheading(90)Sets the pen to the 0th degree
circlesizecircle(10)Sets the radius of the circle
gotox, ygoto(90,0)Moves turtle to a given coordinate
begin_fillNonebegin_fill()Marks the start of the color fill
end_fillNoneend_fill()Marks the end of the color fill
fillcolorcolornamefillcolor('purple')Sets the color of the fill

[2] Deliverables #

⚑✨

πŸ€” Remember, at the end of each class we push to Github

πŸ’» Push your work to Github:

  • git status
  • git add -A
  • git status
  • git commit -m “describe your drawing and your process here”

    be sure to customize this message, do not copy and paste this line

  • git push