Level 1: Turtle Graphics - IncrediCoders/Python1 GitHub Wiki

GitHubAvatarPoint

Grafika Turtle added this page on March 14, 2025


Here is a bonus article that will tell you more about what Turtle Graphics means in computer programming!

In addition to this bonus article, you can find other bonus articles that teach you the topics I covered in Level 1: Object‐Oriented Programming, Troubleshooting & Error Handling, Syntax, Methods, and Comments.

Learn About Turtle Graphics

Turtle Graphics is a fun way to learn coding by drawing pictures using simple commands. You control a turtle on the screen, it's like a little robot with a pencil. You can tell it to move forward, turn, change colors, and draw shapes.

Why Turtle Graphics Matters

Turtle Graphics helps you understand coding ideas like steps, directions, loops, and coordinates. But instead of just numbers and words, you get to see your code in action through drawings.

Python Example

Let's use the Turtle Graphics in Python!

In Python, Turtle Graphics are implemented by using the import turtle command. Once you've imported this library, you can now use the contents to start drawing with a turtle in Python!

In Visual Studio Code (VSC), create a new Python file by clicking File -> New File. A popup from the center of VSC will drop down so you can select "Python File".

A new file named "Untitled-1" should appear in the center of VSC, as show below. image

Let's go ahead and type in the import turtle code in Line 1. This will allow us to use the turtle library to visualize our code.

On Line 3, let's type in turtle.forward(100). This will move our pointer (turtle) 100 units in the direction it is currently facing. By default, the pointer is facing the right.

On Line 5, let's type in turtle.exitonclick(). This line of code will allow us to see what is being displayed without it disappearing immediately.

Let's run our code! Press the Run Code button on the top right of the window and you should be prompted to save and name your file. I've named my file "turtlegraphicsintro.py".

Press the Run Code button again and you should see the window below. image

Congratulations! This is your first usage of Turtle Graphics in Python!

Comparing Programming Languages

Turtle Graphics is mainly used in Python, but there are a few other languages that use it, listed below. Most other languages don’t come with turtle drawing tools built-in, and need more setup or use game libraries for you to use it for turtle graphics. That’s one of the reasons why Python is a great place to start for drawing with code.

We'll discuss two other programming languages that also have built-in Turtle Graphics. First, Logo is an educational programming language developed in 1967 that's often used for Turtle Graphics.

Small Basic is also an educational programming language developed by Microsoft that includes Turtle Graphics to help visualize code. The fundamentals of the code are very similar to the code we wrote earlier in Python.

Next, the following examples show how turtle graphics look differently in the different languages. All these examples command the turtle to move forward for 100 units and draw a line.

Python

turtle.forward(100) # Move forward by 100 units

Logo

pen.forward(100)

Small Basic

Turtle.Move(100)

Learn More

TBD

Next Steps

Next, if you need help completing the Turtle Map project in the book, you can find help at Level 1: Help.

After you complete Level 1 in the book, you can also take on the two extra challenges to add to your Turtle Map program and learn more! When you're done, you can move on to Level 2, the Class Introductions program!

Take the Challenges!

  1. Challenge 1: On this page, I show you how to map a different route to our school, the IncrediCoders Academy. This time, we're going to cross the bridge, over the lake.

  2. Challenge 2: For this challenge, I'll show you how to create a loop, so that you can have the turtle go back and forth between my house and the school, five times.

More Level 1 Resources

In addition to this Bonus Article and the instructions for our Level 1 challenges, we also have Online Articles, a Learning Quiz, an Unplugged Activity, and a Rewards article:

  • Level 1: Online Articles - I made you a list of different web pages I found, which will help you learn more about Turtle Graphics.

  • Level 1: Learning Quiz - I wrote some questions in case you want to quiz yourself about what you learned. Or you can teach others and quiz them! You'll find the answers to the quiz in the Level 1 Solutions folder.

  • Level 1: Unplugged Activity - I wrote this page with more details than what you saw in the book. In this game, you'll have one person act as the Turtle, and one person is the Programmer!

  • Level 1: Rewards - If you completed the Turtle Map project that we talked about in the car, then I set up this page to be your reward. You can see some illustrations of me and learn more about who I am! You'll also find the Turtle Award digital download, to show off your accomplishment!

Level 2

After you're completely done with Level 1 (did you do the challenges?), then it's time to move on to Level 2! While you read through Level 2 in your book, you can check out the resources from Mrs. Scratcher, as she teaches you how to build the Class Introductions program:

I hope you had fun learning about the concept of Syntax! After all, my brother was named after it!

-- Grafika Turtle

⚠️ **GitHub.com Fallback** ⚠️