Review: Turtle Drawing #
Welcome to CS10! We hope you’re excited for what we have planned this year! π
Let’s review by taking it back to CS9 Turtle drawings!
[0] Set up #
π Github Repo: github.com/Making-with-Code/lab_turtle_review
π»
cd
into the lab
cd lab_turtle_review_yourgithubusername
πΎ π¬ Windows Users
We 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 shell
When you want to exit the shell, you can type
exit
or^D
[1] Create a Turtle Drawing #
π»
Using the starter code in turtle_drawing.py
create a drawing that includes at least 3 of CS concepts below:
- Variables
- Loops
- Conditionals
- Lists
- Dictionaries
- Functions with parameters
A Few Helpful Functions #
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