How to Draw the Houston Astros 2000-2012 Logo in Python IDLE Shell Using Turtle

by laserdude239 in Craft > Digital Graphics

30 Views, 0 Favorites, 0 Comments

How to Draw the Houston Astros 2000-2012 Logo in Python IDLE Shell Using Turtle

Houston Astros Alternate Logo History.jpg

Coding can be quite daunting for beginner programmers. Luckily, Python's "Turtle" feature is widely regarded as an easy-to-use, beginner-friendly introduction to coding, allowing programming novices to gain some comfort with the language. Today, I'll demonstrate some of the Turtle class's basic methods and functionalities, and showcase how to utilize them to draw the Houston Astros 2000-2012 logo in Python's IDLE shell.

Install Python

Screenshot 2024-10-05 222353.png

Before we can get to coding, we must first make sure we have the correct version of Python installed on your device. Ensure that you have Python version 3 on your device or higher installed. If not, you can download it from the Python website. Here are two tutorials explaining the installation process for Mac and PC.


  1. Tutorial for Windows Users
  2. Tutorial for Mac Users


Open Python IDLE Shell

Screenshot 2024-10-05 224515.png
Screenshot 2024-10-05 224625.png
Screenshot 2024-10-05 232642.png

Once you've launched Python, a window should appear with the version number and a blank page for the user to write text. This window is called the terminal. Navigate to the upper left corner and click File. A dropdown menu will open. From this screen, click "New File" or press Ctrl+N. This will open a second screen called the IDLE Shell. This screen can be used to write multiple lines of code that can be run all at once, The output will be displayed on another screen.

Turtle Methods

Before we can begin writing the code, we must first familiarize ourselves with some of our new turtle methods and their functionalities. The following are a few basic ones:

  1. .penup()
  2. Lifts the pen off of the virtual canvas. When pen is lifted, it will not draw when moved.
  3. .pendown()
  4. Drops the pen onto the virtual canvas, When moved, pen will draw.
  5. .goto()
  6. Moves the pen from its resting location to a specific coordinate.
  7. .color()
  8. Allows user to change pen color
  9. .begin_fill()/.end_fill()
  10. After writing script to create a closed shape, using these functions to bookend your script will fill in the shape. We'll get more into detail when we use these functions in practice later.

Choose a Drawing

Screenshot 2024-10-06 010053.png

Next, it's time to select a drawing. I chose the 2000-2012 logo of the Houston Astros MLB Organization. The above functions can be used to create straight lines, so I chose a symbol comprised of only sharp corners and straight edges. Above is a template we can use to plot the logo on a coordinate grid.

Import Turtle Library

The first step in writing our script will be to import the turtle library. "Turtle" is a pre-installed class containing specific functions that allow a programmer to create shapes and drawings. Before we can use these functions in our script, we first must import the library containing them. To do so, we must insert the following brief line of code into our IDLE script.

import turtle

Create Outer Layer

Screenshot 2024-10-06 012713.png
Screenshot 2024-10-06 114847.png

With our library imported and our drawing template chosen, we can begin our script!

The first thing that must be done is to initialize our turtle drawing by assigning it to a variable. This is done with the following line of code.

tur = turtle.Turtle()

Note that I've chosen "tur" as the name of my variable. You can replace this with any variable name you like.

Next, I'll be mapping the outer layer of the star. Since I'll be starting off-center, I'm going to begin by lifting my pen off of the page, moving it to the coordinate of my choice, telling Python that I'll be filling my closed shape with .begin_fill(), and putting the pen back on the page before forming any lines/shapes. This is done with the following code:

tur.penup()
tur.begin_fill()
tur.goto(0,24)
tur.pendown()

Notice that we reference the "tur" variable we defined earlier in each of these method uses. We'll be doing this with every line of code we need for the rest of this drawing. Next, we can use the .goto() method to move our pen across the canvas, line by line, until we have something resembling our star. This can be done by copying and pasting the following code into the IDLE shell.

tur.goto(8,0)
tur.goto(33,0)
tur.goto(13,-13)
tur.goto(20,-37)
tur.goto(0,-24)
tur.goto(-57,-65)
tur.goto(-69,-106)
tur.goto(0,-58)
tur.goto(69,-106)
tur.goto(45,-25)
tur.goto(115,27)
tur.goto(27,27)
tur.goto(0,113)
tur.goto(-27,27)
tur.goto(-115,27)
tur.goto(-81,0)
tur.goto(-8,0)
tur.goto(0,23)

This is the code for each penstroke for the outer layer of our drawing. All that's left to do is lift our pen off the page and tell Python that our closed shape is ready to be filled in with the following lines of code.

tur.end_fill()
tur.penup()

To run your script, press Fn+F5 (Or Run>Run Module) and save your code file anywhere on your device. You'll only have to make this save the first time you run your code. A new window should appear with your virtual canvas and your new design!

To review the entire script thus far, view the code screenshot at the top of step 6.

Create Middle Layer

Screenshot 2024-10-06 115911.png
Screenshot 2024-10-06 115840.png

With our first layer created, we must now repeat the process two more times for the middle and innermost layers.

There's one small difference from our first script, however: we must now consider pen color. The turtle will default to a black pen color unless we specify that another color is needed. For the middle layer of the Astros logo, a sand/beige color is needed.

There is no shortage of online resources for finding the hex codes of sports/commercial logos. I used this website to find the exact hex codes needed for the next two layers of this logo. The setup for the middle layer of the Astros logo looks like this:

tur.goto(0,34)
tur.color('#D3BC8D','#D3BC8D')
tur.begin_fill()
tur.pendown()

Note that we already lifted the pen in step 6, allowing us to move freely to position ourselves for the middle layer before lowering it again. The hex code is entered twice, once to define the line color and again to define the fill color. The same process from step 6 is repeated with slightly different coordinates:

tur.goto(10,4)
tur.goto(42,4)
tur.goto(16,-15)
tur.goto(27,-45)
tur.goto(0,-27)
tur.goto(-55,-67)
tur.goto(-67,-102.5)
tur.goto(0,-55)
tur.goto(67,-102.5)
tur.goto(42,-24)
tur.goto(108,25)
tur.goto(26,25)
tur.goto(0,102.5)
tur.goto(-26,25)
tur.goto(-108,25)
tur.goto(-81,4)
tur.goto(-10,4)
tur.goto(0,34)
tur.end_fill()
tur.penup()

Once this code has been typed (or pasted) into the shell, run the code to check for errors and prepare for the final layer! (See image above for code of the entire middle layer)

Create Final Layer

Screenshot 2024-10-06 121559.png
Screenshot 2024-10-04 201452.png

With one layer left, repeat the processes from steps 6 and 7. Use the following code to align your pen and change its color to brick red.

tur.goto(0,44)
tur.color('#9A3324','#9A3324')
tur.begin_fill()
tur.pendown()

Use the following code to outline and fill the final layer.

tur.goto(12,8)
tur.goto(51,8)
tur.goto(19,-17)
tur.goto(34, -52)
tur.goto(0,-30)
tur.goto(-53,-68)
tur.goto(-62,-94)
tur.goto(0,-52)
tur.goto(62,-94)
tur.goto(38,-24)
tur.goto(98,22)
tur.goto(23,22)
tur.goto(0,92)
tur.goto(-23,22)
tur.goto(-98,22)
tur.goto(-80,7)
tur.goto(-13,7)
tur.goto(0,44)
tur.end_fill()
tur.penup()

Run your code and marvel at your new creation!


Python is known to many as the best language for beginners to learn programming. This exercise should help these novice coders familiarize themselves with writing scripts.