October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

How to Add an Image to Python Turtle: Backgrounds and GIF or PNG Shapes

Use bgpic() for a Turtle window background, or register an image before assigning it as the turtle shape. PNG shape support requires Python 3.14 or later.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Python Turtle handles images in two different ways: use Screen.bgpic() to place an image behind the drawing, or register an image with Screen.register_shape() and select it with Turtle.shape() to use it as the turtle’s sprite. The supported formats depend on your Python version, especially for PNG turtle shapes.

Choose how you want to use the image

Use API Result
Screen background screen.bgpic(filename) The image appears behind the drawing.
Turtle sprite screen.register_shape(...), then turtle.shape(...) The image is used as the turtle’s shape. Image shapes do not rotate when the turtle turns, so they do not indicate its heading.

Both methods are documented in the Python 3.15 turtle reference, but supported image formats differ by Python version for image shapes.

As an Amazon Associate I earn from qualifying purchases.

How do I set a background image in Turtle?

Get the screen and pass the image filename to bgpic():

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import turtle

screen = turtle.Screen()
screen.bgpic("background.gif")
turtle.done()

The current reference documents PNG, GIF, PGM, and PPM filenames for bgpic(). To remove the background image, call screen.bgpic("nopic"). Calling screen.bgpic() without an argument returns the current background-image filename. turtle.clear() is not the documented way to remove that image.

Keep the image file accessible to the program when it runs; if it is not alongside the script in the working directory, provide an appropriate path in the filename argument.

How do I make an image the turtle shape?

Register the image with the screen before selecting it as the turtle’s shape:

import turtle

screen = turtle.Screen()
screen.register_shape("sprite.png")

pen = turtle.Turtle()
pen.shape("sprite.png")
turtle.done()

You can also give the image a separate shape name, then use that name with shape():

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
screen.register_shape("sprite", "sprite.gif")
pen.shape("sprite")

The filename must be registered before shape() can select it. The image remains visually unrotated as the turtle turns.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Can Python Turtle use PNG?

Yes, but check your Python version if you want to use a PNG as the turtle shape. The current Python reference lists PNG, GIF, PGM, and PPM image files for backgrounds and image shapes. Its register_shape() entry says PNG, PGM, and PPM support for image shapes was added in Python 3.14. The Python 3.10 reference shows the older GIF-based image-shape behavior. If you are on an earlier release, consult the documentation for that installed version rather than assuming PNG turtle shapes are supported.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.