United States · Grade 3 to Grade 12 · Python turtle

Python turtle not working? Start here

For many students, turtle is the first typed Python they meet, whether in a middle school computer science elective, an after-school club or a summer camp. It is also where they meet their first confusing failure: an error before anything draws, a window that flashes and vanishes, or arrow keys that do nothing. Almost every case comes from a short list of causes. This page goes through them with the messages Python really prints. Each message is either quoted from the official docs or reproduced on our own test laptop (Python 3.13.6, Tk 8.6), and every one says which. Then it shows how to write text on the turtle screen.

Live teaching since 2020 · 10,000+ students · Turtle graphics in our Python course for kids

In short

When Python turtle is not working, check four things in order: your file is not named turtle.py (that file hides the real module), the program ends with turtle.done() so the window stays open, tkinter is installed (turtle needs it), and screen.listen() is called if you use keys. Text goes on screen with write(). At Modern Age Coders, turtle graphics is part of our live Python course for children in Grade 3 and above, taught in a group batch or one to one.

Learn it with a teacher

Three courses that take turtle drawings somewhere

Turtle is a starting point. Each course below begins there and moves on to real programs.

Match your symptom

What you see, what it usually means

Find the row that matches what happened on your screen. Each cause is explained further down the page.

Turtle symptoms and causes (our table; the messages are from our run of Python 3.13.6 or the Python documentation)
What happensWhat Python printedMost likely cause
Error on the first turtle linemodule 'turtle' has no attribute 'Turtle'Your own file is named turtle.py
Error before anything runsStandard library module '_tkinter' was not foundtkinter is missing from this Python install
A window flashes and closesNothing at allNo turtle.done() at the end of the program
Arrow keys do nothingNothing at allscreen.listen() was never called
Error naming a colorbad color string: bleuA misspelled color name
Error with three numbers as a colorbad color sequence: (240, 160, 80)Color mode is 1.0, not 255
Error on a turtle command'Turtle' object has no attribute 'forwad'. Did you mean: 'forward'?A typo in the command name
Error after closing the windowinvalid command name ".!canvas"A turtle command ran after the window was gone

The _tkinter and color-sequence messages are quoted from the turtle documentation; the others come from our own run of Python 3.13.6 with Tk 8.6 on Windows 11, 17 October 2026. We are not connected with the Python Software Foundation.

Cause number one

The file named turtle.py: why import turtle stops working

It feels sensible to save your first turtle program as turtle.py. It is also a very common reason import turtle fails, because Python then imports your file instead of the real module.

Broken · the program is fine, the file name is notpython
# Saved as turtle.py  (the bug is the file name, ours)
import turtle
t = turtle.Turtle()
t.forward(100)
turtle.done()

# Our run, Python 3.13.6:
# AttributeError: module 'turtle' has no attribute
#   'Turtle' (consider renaming 'turtle.py' since it
#   has the same name as the standard library module
#   named 'turtle' and prevents importing that
#   standard library module). Did you mean: 'turtle'?

Python 3.13 added the "consider renaming" hint; the Python 3.13 release notes show the same message for a file named random.py. Older versions print only the first part, which is far less helpful.

Why Python picks your file

The Python tutorial explains that "The directory containing the script being run is placed at the beginning of the search path, ahead of the standard library path." So when your folder holds turtle.py, import turtle finds that file first.

The tutorial adds, flatly: "This is an error unless the replacement is intended." Your file has no Turtle class in it, so the very next line fails.

The fix, in three moves

Rename the file to something like star_card.py or my_drawing.py. Anything except the name of a module you import.

Run the renamed file and read the first line of any new error. With the real module back, the program either draws or fails on a different, honest line.

Check the folder for other borrowed names too. A file called random.py or math.py breaks those modules in exactly the same way.

The window

The window closes at once, never opens, or freezes

Turtle draws in a desktop window made by tkinter, Python's interface to the Tk toolkit. Window problems tend to come from that window being closed too early, never being allowed to open, or not being available at all.

It flashes and closes

When the last line finishes, the program ends and takes the window with it. The documentation says turtle.done() "Must be the last statement in a turtle graphics program." Add it, or use turtle.exitonclick() to close on a mouse click.

It never opens

The documentation is clear: "Turtle graphics requires the tkinter optional module." If you see an error mentioning _tkinter, this Python install has no Tk support. Running python -m tkinter should open a small test window when tkinter works.

It freezes or will not close

This usually happens when a program is run twice in one session, or a loop never ends. Close the window, restart the Python shell or kernel, and run the file fresh. Add turtle.done() once, at the very end.

Will turtle open a window here? (from the Python documentation, plus our reasoning, labelled)
SettingWhat the documentation saysWhat that means for a student
python.org Python on Windows or macOS"The python.org installers for Windows and macOS include it"Turtle should work after a normal install
Python on Linux, including some school setupsSome Linux distributions "may package it separately"Ask whoever set up the computer to add the Tk package
IDLE, the editor that comes with Pythondone() must not be used if IDLE runs in -n modeIn a normal IDLE install, done() is fine
A browser notebook running on a remote serverNot covered by the turtle documentationOur reasoning: the code runs on another machine, so there is no desktop window for tkinter to open on your screen

Quotes from the turtle and tkinter documentation, read 17 October 2026. tkinter lists Tcl/Tk 8.5.12 as its minimum supported version; our test machine reported Tk 8.6.

How to write in turtle

How to write text on the turtle screen

Searches for how to write in turtle mostly mean one thing: putting words on the drawing. The command is write(), and the documentation gives its full form as write(arg, move=False, align='left', font=('Arial', 8, 'normal')).

Working · a star card with a centered messagepython
# star_card.py  (ours; any name except turtle.py)
import turtle

screen = turtle.Screen()
screen.bgcolor("lightyellow")
t = turtle.Turtle()
t.color("purple")
t.speed(6)            # 6 is "normal"

for side in range(5):
    t.forward(150)
    t.right(144)      # 5 x 144 = 720: two full turns

t.penup()             # move without drawing
t.goto(75, -60)
t.write("Happy birthday, Ava", align="center",
        font=("Arial", 18, "normal"))
t.hideturtle()
turtle.done()         # keeps the window open

We ran a test copy of this program: the star closed neatly and the turtle finished at (75.00, -60.00) facing heading 0.0, because five turns of 144 degrees add up to 720, exactly two full turns.

The parts of write(), from the turtle documentation
PartWhat it doesOur tip
argThe object to write; its string form appears on screenNumbers work alone, but joining them to text needs str()
alignOne of "left", "center" or "right", measured from the turtleUse "center" for titles and labels
fontA triple: (fontname, fontsize, fonttype)Size 8 is the default and is tiny; try 16 to 24
moveIf true, the pen moves to the bottom-right corner of the textLeave it False unless you are writing a line in pieces
Broken, then fixed · the score label mistakepython
# The write() mistake (ours)
points = 42
t.write(points + " points")      # TypeError

# Our run: TypeError: unsupported operand type(s)
#   for +: 'int' and 'str'

t.write(str(points) + " points") # works
t.write(f"{points} points")      # also works

The error is ordinary Python, not turtle: a number and a string cannot be added. Convert the number first.

Keys, colors and speed

Keys that do nothing, colors that crash, and a turtle that is too slow

Once the window opens, the next round of trouble usually comes from three settings that the documentation explains in a line each.

Working · arrow keys that move the turtlepython
# arrow_keys.py  (ours)
import turtle

screen = turtle.Screen()
t = turtle.Turtle()

def go_up():
    t.forward(20)

def turn_left():
    t.left(30)

screen.onkey(go_up, "Up")
screen.onkey(turn_left, "Left")
screen.listen()       # without this, keys are ignored
turtle.done()

The documentation says that to register key events, the TurtleScreen "must have the focus", which is what listen() does. Click the turtle window once too, so the keyboard is talking to it and not to your editor.

Colors: names, hex codes and number triples

A color name is a Tk color specification string, which the documentation illustrates with "red", "yellow", or "#33cc8c". A misspelling such as "bleu" stops the program with bad color string: bleu.

Three numbers like (240, 160, 80) only work after screen.colormode(255). In the default mode each value must be between 0 and 1.0, and the documentation shows the resulting error: bad color sequence: (240, 160, 80).

Speed: why 0 is the fastest

speed() takes 0 to 10 or a word. The documentation maps "fastest" to 0, "normal" to 6 and "slowest" to 1, and warns that "speed = 0 means that no animation takes place".

So speed(0) is not "stopped"; it is "draw instantly". For large drawings, students also use tracer(0) with update() to draw everything at once.

Asking the user for input inside turtle works too: textinput() pops up a dialog and, as the documentation notes, returns None if the dialog is canceled, so check for None before using the answer.

Checklist

Ten checks, in order, for any turtle program that will not work

Our checklist, in the order our teachers use it. Stop as soon as one check explains the error.

  1. Read the last line of the error. It names the type (AttributeError, TypeError, TurtleGraphicsError) and usually the word that is wrong.
  2. Check the file name. If it is turtle.py, rename it and delete any cached turtle file in the same folder.
  3. Check the last line of the program. It should be turtle.done() or turtle.exitonclick(), once, at the end.
  4. Check the capital T. The module is turtle; the class is Turtle. Our run of turtle.turtle() printed: module 'turtle' has no attribute 'turtle'. Did you mean: 'Turtle'?
  5. Check spelling of commands. Python 3.13 suggests the nearest real name, as it did for forwad.
  6. Test tkinter on its own. Run python -m tkinter. If no test window appears, the problem is the Python install, not your code.
  7. Check colors. Names must be real Tk color names; number triples need colormode(255).
  8. For keys, check listen(). And click the turtle window before pressing anything.
  9. Restart before rerunning. Close the old window and restart the shell, so an old screen is not still attached.
  10. Make it smaller. Comment out everything except the first three lines and add lines back one at a time until it breaks.

When the error appears after you close the window

If a program keeps drawing after the window has gone, tkinter has nothing to draw on. In our test, calling turtle.bye() and then t.forward(50) ended with _tkinter.TclError: invalid command name ".!canvas".

The fix is structure, not luck: draw everything first, then let turtle.done() hold the window open as the final line.

School assignments

If the drawing is a graded school assignment, we will explain why the program fails and teach the idea behind it, but we do not draw anyone's assignment for them.

In a lesson, students bring the broken file, and the teacher asks them to read the error aloud first. Fixing it themselves is the part that sticks.

Where turtle leads

From a first square to real programs

Turtle was built for learning. The documentation describes it as an implementation of the drawing tools introduced in Logo in 1967 and notes that its "instant, visible feedback makes it an effective way for learners to encounter programming concepts."

What turtle teaches across a first term (our plan for Grades 3 to 8, adjusted for each child)
ClassesWhat gets drawnThe idea behind it
1 to 2Squares, triangles, a houseSequence: commands run in order
3 to 4Stars and spirals with for loopsLoops, and angles that add up to full turns
5 to 6Functions like draw_flower(size)Functions and parameters
7 to 8Random colors and positionsVariables, random numbers, color modes
9 to 10An arrow-key drawing gameEvents and the main loop
11 to 12A card or poster with textPutting it all together; write() and layout

After turtle, children move on to games and data. For age-by-age starting points, see Python for 10 year olds and Python for 12 year olds; for younger children, online coding classes for US kids.

From first line to first game

Four stages of turtle programming

Where a young coder might be, and what comes next.

Stages with Python turtle (ours)
StageWhat it looks like
1. TypistCopies commands line by line from a worksheet
2. LooperReplaces repeated lines with a for loop
3. BuilderWrites functions that draw shapes of any size
4. Game makerUses keys, events and text to make something interactive

For parents

A child who can explain why five turns of 144 degrees make a star is doing geometry and programming at once.

Errors are part of the work. The useful question is whether your child reads them before asking for help.

For kids

Never name your file turtle.py. Give it a name about what it draws.

End every program with turtle.done(). Then the window waits for you.

The catalogue

Nine courses for young Python coders

Taught live online by a regular teacher, in a batch or one to one.

I

Kids

Grades 3 to 8
II

Teens

Ages 13 to 18

TRT / TEN / 03

JavaScript for teens

Drawing and games in a browser.

Open the syllabus
III

Going further

Teens and adults

TRT / PRO / 01

Problem solving for teens

Loops and logic, harder puzzles.

Open the syllabus

TRT / PRO / 02

AI and machine learning for teens

Python models, ages 13 to 18.

Open the syllabus

TRT / PRO / 03

Python for adults

Zero to advanced, ages 18 and up.

Open the syllabus

How lessons run

Live turtle lessons from home

Weekdays or weekends, flexible: choose your batch, or for a very personalised plan choose 1-on-1 at your convenience, weekend mornings or weekdays.

Weekdays

Batches placed for US time zones.

Weekends

Popular with younger children.

1-on-1

A schedule built around your child.

A familiar face

One teacher across the term.

Screen shared

The teacher sees the turtle window too.

Broken files welcome

We start from the error.

Explain, then fix

Children fix their own code.

Anywhere in the US

A laptop with Python is enough.

Batch or private

Fifteen to twenty, or one child.

Student work

What our students drew and built

Work from learners whose first programs were turtle shapes too. More on the student labs page.

NutriLife AI nutrition coach project screenshot

AI and ML

NutriLife

An AI nutrition coach that reads what you eat and works you toward a target.

by Bhavya · Open it

Misti AI chatbot for maths and coding screenshot

AI and ML

Misti

A chatbot that answers mathematics and programming questions, built and deployed by a student.

by Harshit · Open it

GuardianX AI internet safety assistant screenshot

AI and ML

GuardianX

An assistant that helps a young person recognise unsafe situations online.

by Vivaan · Open it

SkyCast weather forecast application screenshot

Web app

SkyCast

A weather forecasting site with live conditions for any location.

by Krish

Fees

Fees

Turtle comes free with Python. You pay only for live lessons, charged monthly in US dollars; there is no term-long commitment, and you may stop after any month.

Free first class

USD 0

no card required

  • A free first lesson
  • Bring the program that broke
  • No card required
Book it

Group batch

USD 100

a month, billed in US dollars

  • Fifteen to twenty learners
  • A regular teacher
  • Choose a batch time
  • Billed monthly
Start here

One to one

USD 150

a month, billed in US dollars

  • One child, one teacher
  • Times you choose
  • A plan around their ideas
Enquire

What families say

Rated 4.9 across 547 Google reviews

Google reviews from parents, unedited.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

Questions families ask

Python turtle problems: common questions

Why is import turtle not working?

A very common cause is a file of your own named turtle.py in the same folder, which Python imports instead of the real module. Rename it. If the error mentions _tkinter instead, this Python install is missing tkinter, which turtle needs.

Why does my turtle window close immediately?

The program ended. Put turtle.done() as the last line, which the Python documentation says must be the last statement in a turtle graphics program, or use turtle.exitonclick() to close it with a click.

How do you write text in Python turtle?

Use write(), for example t.write("Hello", align="center", font=("Arial", 18, "normal")). The text appears at the turtle's position. Convert numbers with str() before joining them to words.

Why do my arrow keys not work in turtle?

Call screen.listen() after setting up onkey(), and click the turtle window once so it has the focus. The documentation says the screen must have the focus to register key events.

Does turtle need tkinter?

Yes. The Python documentation says turtle graphics requires the tkinter optional module. The python.org installers for Windows and macOS include it, and running python -m tkinter shows a test window when it is working.

Why does turtle say bad color string?

The color name is not one Tk recognizes, often a typo. Use a real name such as red or a hex code such as #33cc8c. For number triples up to 255, call screen.colormode(255) first.

Does Python turtle work on a Chromebook?

Turtle needs a desktop window from tkinter, so it works where a full Python install with tkinter can run. On a school Chromebook that depends on how the device is set up, so ask your teacher which Python environment the class uses.

Can you do my turtle assignment?

No. We explain why a program fails and teach the idea so the student can finish their own work. We never complete graded assignments.

What times are classes for US families?

Weekdays or weekends, flexible. Choose your batch, or for a very personalised plan choose 1-on-1 at your convenience, weekend mornings or weekdays.

How much do turtle and Python classes cost?

The first lesson costs nothing. After that you pay month by month for live teaching, and the fees section on this page shows the amount in US dollars.

Elsewhere on this site

Related pages

More for US families whose children are starting Python.

Coding classes in the USA

Our full set of pages for US families.

Online coding for US kids

Classes for ages 6 to 14.

Python for 10 year olds

A starting point for fifth graders.

Python for 12 year olds

A starting point for seventh graders.

How to debug code

A method for any bug, turtle or not.

Student labs

Projects our learners have shipped.

Scratch not working

Scratch not working? Saving, sign-in, school network and tablet fixes, from the Scratch Help Center.

MakeCode Arcade help

MakeCode Arcade help: jumping, gravity, tilemap levels and lost projects.

Roblox Studio errors fixed

Roblox Studio errors from the Creator docs: 403, 502, HTTP, endless waits.

Start here

Book a free first lesson

Tell us what your child is drawing and where it goes wrong. The teacher opens the same program in the first lesson.

Before booking, you can read how a lesson works or browse all our courses with their syllabuses.

WhatsApp us · +91 91233 66161 · connect@modernagecoders.com

Our teachers are in India and teach entirely over video, so families anywhere in the US join from home. A WhatsApp message gets the quickest answer.

Free first lesson. Card details are never requested.

Want a class sooner? Book a priority demo

A priority demo is a full class of about 45 to 60 minutes. After the class the mentor sends a written skill report and a personal learning roadmap on WhatsApp. If you enrol, the demo fee is adjusted against your first month's fee. Share your demo Order ID with us on WhatsApp and we take it off.

Book a priority demo

Keep exploring Modern Age Coders

Related courses and guides

Learn more

Free resources

From the blog

Start here

Free classPriority demoCall us