Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To change a Python Turtle window’s solid background, call screen.bgcolor(...). Use a color name, a hex string such as "#800080", or RGB values. To use an image file instead, call screen.bgpic(filename); it is a separate setting from the background color.
How to change the Python Turtle background color
Create the screen, set its background color, then start the Turtle event loop. This example uses a color name:
import turtle
screen = turtle.Screen()
screen.bgcolor("lightblue")
turtle.done()
The Python 3.14.7 turtle library reference documents Screen.bgcolor() as both a setter and a getter: pass a color to change the background, or call it without an argument to get the current color.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →How to use a hex color in Turtle
Pass a Tk color specification as a string. Hex notation works directly:
#1 Best Overall
import turtle
screen = turtle.Screen()
screen.bgcolor("#800080") # purple
turtle.done()
The same method accepts recognized color-name strings, such as "lightblue". The reference’s example sets "#800080" and reads the resulting color as (128.0, 0.0, 128.0) using bgcolor() with no argument: Screen.bgcolor() reference.
How to set an RGB background
You can pass RGB components as a tuple or as three separate arguments. The valid component range depends on the screen’s color mode, so set that mode before supplying numeric RGB values:
Rank #2
import turtle
screen = turtle.Screen()
screen.colormode(255)
screen.bgcolor(128, 0, 128)
# Equivalent: screen.bgcolor((128, 0, 128))
turtle.done()
With color mode 255, each component must be from 0 through 255. In mode 1.0, each component must be from 0.0 through 1.0. The supported modes and ranges are documented in the Screen.colormode() reference. Choose values in the range for the active mode; for example, (128, 0, 128) belongs to mode 255.
How to add a background image
Use bgpic() when the background should be an image rather than a flat color. Supply a filename or path to a local image:
import turtle
screen = turtle.Screen()
screen.bgpic("landscape.gif")
turtle.done()
The Python reference documents PNG, GIF, PGM, and PPM image formats for bgpic(). The image file must be reachable at the path your program supplies; if it does not load, check the filename, path, and image format in your installed Python and GUI environment. See the Screen.bgpic() reference.
Call screen.bgpic() with no argument to get the current background image name. To remove a background image, use the special filename "nopic":
screen.bgpic("nopic")
Which Turtle background method should you use?
| What you want | Method | Input |
|---|---|---|
| A solid color by name | bgcolor() |
A Tk color string, such as "lightblue" |
| A solid color in hex | bgcolor() |
A Tk color string, such as "#800080" |
| A solid color in RGB | bgcolor() |
A tuple or three components; numeric values must match the active colormode |
| A picture behind the drawing | bgpic() |
A reachable image filename in a documented format |
What happens when the Turtle screen is reset?
The documented reset state uses a white background and no background image. If your program resets the screen and needs a custom background afterward, set the color again with bgcolor() or reload the image with bgpic(). See the Screen.reset() reference.
Quick Recap
Best Value
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.

