Recently, I was working on a Python project for my nephew where I needed to create a simple game with custom character graphics. The standard turtle shape wasn’t cutting it; I needed to use actual images of animals and objects to make the game engaging.
The issue is, there’s no simple”attach_image()” method in the Turtle module. But don’t worry, there are several workarounds we can use.
In this article, I’ll cover four simple methods to attach images to Python Turtle objects that I’ve personally used in multiple projects.
Methods to Attach an Image to Turtle Python
Now, I will explain to you the methods to attach an image to the turtle Python.
1 – Use register_shape() to Replace the Turtle with an Image
The simplest way to replace the default turtle arrow with your image is to use the register_shape() method in Python. This is perfect when you want your turtle to appear as a custom character like a spaceship, animal, or any other image.
Here’s how to do it:
import turtle
# Set up the screen
screen = turtle.Screen()
screen.title("Custom Turtle Shape")
# Register the image as a shape
image_path = "spaceship.gif" # Must be a GIF file
screen.register_shape(image_path)
# Create a turtle and set its shape to our image
my_turtle = turtle.Turtle()
my_turtle.shape(image_path)
# Move the turtle to demonstrate it works
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(50)
turtle.done()You can refer to the screenshot below to see the output.

Important Note: The Turtle module only supports GIF files by default. If you have images in other formats like PNG or JPG, you’ll need to convert them to GIF first.
I’ve found this method perfect for simple games where characters need to move around the screen, like a Space Invaders clone or a maze game.
2 – Add a Background Image
Sometimes you need to set a background image rather than changing the turtle itself. This is great for creating game levels, scenery, or themed applications.
Here’s how to add a background image in Python turtle:
import turtle
# Set up the screen
screen = turtle.Screen()
screen.title("Turtle with Background Image")
# Set the background image
background_image = "usa_map.gif" # Must be a GIF
screen.bgpic(background_image)
# Create a turtle for demonstration
my_turtle = turtle.Turtle()
my_turtle.penup()
my_turtle.goto(-100, 0)
my_turtle.write("USA Map Background", font=("Arial", 16, "bold"))
turtle.done()You can refer to the screenshot below to see the output.

I used this technique when creating a USA states quiz game where students had to click on different states on a map. The background image was a map of the United States, and turtles were used as markers for correct answers.
3 – Use stamp() with Custom Shapes
Another approach I frequently use is combining register_shape() with the stamp() method. This allows you to place multiple instances of an image without creating multiple turtle objects.
import turtle
# Set up the screen
screen = turtle.Screen()
screen.title("Stamping Custom Images")
# Register our custom shape
screen.register_shape("star.gif")
# Create a turtle and hide the default arrow
stamper = turtle.Turtle()
stamper.shape("star.gif")
stamper.penup()
# Stamp stars in different locations
for x in range(-150, 151, 75):
for y in range(-150, 151, 75):
stamper.goto(x, y)
stamper.stamp()
# Hide the turtle after stamping
stamper.hideturtle()
turtle.done()You can refer to the screenshot below to see the output.

I’ve used this technique to create a star-field background for a space game and to place coins or collectibles in platform games. It’s much more efficient than creating a new turtle object for each image.
4 – Use the PIL Library for Advanced Image Support
The methods above only work with GIF files, which can be limiting. When I need to use PNG, JPG, or other image formats, I turn to the Python Imaging Library (PIL).
First, you’ll need to install PIL if you haven’t already:
pip install pillowNow here’s how to use it with Turtle:
import turtle
from PIL import Image, ImageTk
# Set up the screen
screen = turtle.Screen()
screen.title("Advanced Image with PIL")
# Create a canvas where we can place the image
canvas = screen.getcanvas()
# Load the image using PIL (can be PNG, JPG, etc.)
pil_image = Image.open("usa_flag.png")
# Resize if needed
pil_image = pil_image.resize((100, 60))
# Convert to format that tkinter can use
tk_image = ImageTk.PhotoImage(pil_image)
# Create a turtle to position our image
my_turtle = turtle.Turtle()
my_turtle.penup()
my_turtle.goto(0, 0)
my_turtle.shape("square")
my_turtle.shapesize(0.01, 0.01) # Make the turtle tiny
# Get the current position in screen coordinates
x, y = my_turtle.position()
screen_x, screen_y = canvas.canvasx(x), canvas.canvasy(y)
# Place the image on the canvas at the turtle's position
# We need to adjust for the center of the image
image_id = canvas.create_image(screen_x, screen_y, image=tk_image)
# Keep a reference to prevent garbage collection
canvas.tk_image = tk_image
turtle.done()I used this method when creating an educational app about American history that needed to display the US flag in high quality. The PIL method gives you much more flexibility with image formats and manipulation.
Read Python Turtle Dot
Troubleshoot in Turtle Python, I’ve encountered a few common issues:
- “Python turtle graphics not responding” – This usually happens when the turtle window freezes. Always include
turtle.done()at the end of your code to keep the window open properly. - Images not showing up – Double-check file paths and make sure your image files are in the same directory as your Python script, or provide the full path.
- File format issues – Remember that methods 1-3 only support GIF format. If your images aren’t showing up, verify they’re in GIF format.
- Image size problems – Very large images might cause performance issues. Consider resizing your images to be appropriate for your application.
Check out Python Turtle Screen Size
Additional Tips for Working with Turtle Images
Based on my experience, here are some practical tips:
- Optimize GIFs: Keep your GIF files small and simple for better performance.
- Use transparent backgrounds: GIFs support transparency, which helps your images blend nicely with colored backgrounds.
- Create sprite sheets: If you need animation, create a GIF with multiple frames.
- Adjust turtle speed: Use
turtle.speed(0)for the fastest drawing if you’re placing many images.
Python Turtle may seem basic, but with these image techniques, you can create engaging visual applications like games, quizzes, and educational tools.
I hope you found this article helpful! If you have any questions or suggestions, please leave them in the comments below. These methods have served me well in numerous projects, from simple educational games to more complex visualizations.
Other Python articles you may also like:

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.