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 UsersWe suggest not copying the path command, and instead using
cd
andls
to ensure you are in the correctmaking_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 shellWhen you want to exit the shell, you can type
exit
or^D
[1] Create a Turtle Drawing #
π» Run the Python filepython 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
Function | Input | Example Use | Explanation |
---|---|---|---|
forward | amount | forward(100) | Moves the turtle forward by the specified amount |
backward | amount | backward(100) | Moves the turtle backward by the specified amount |
right | angle in degrees | right(45) | Turns the turtle clockwise by the specified angle |
left | angle in degress | left(45) | Turns the turtle counter clockwise by the specified angle |
color | colorname | color('red') | Sets the color for drawing. Use “red”, “black”, etc. Here’s a list of all the colors. |
speed | number from 0-10 | speed(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. |
pendown | None | pendown() | Puts down the turtle/pen so that it draws when it moves |
penup | None | penup() | Picks up the turtle/pen so that it doesnβt draw when it moves |
pensize | width | pensize(4) | Sets the width of the pen for drawing |
setheading | angle | setheading(90) | Sets the pen to the 0th degree |
circle | size | circle(10) | Sets the radius of the circle |
goto | x, y | goto(90,0) | Moves turtle to a given coordinate |
begin_fill | None | begin_fill() | Marks the start of the color fill |
end_fill | None | end_fill() | Marks the end of the color fill |
fillcolor | colorname | fillcolor('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