Turtle Graphics Not Responding

ElectroNerd picture ElectroNerd · Aug 27, 2011 · Viewed 38.8k times · Source

I am creating diagrams with the turtle package in Python, and it is successful to some extent, except for one problem. Once turtle generates the diagram that I have in code, it causes the program to say "Not responding" and eventually I have to end the task. I am using Windows 7.

Have any of you experienced this or know the root cause? I tried reinstalling Python completely, but that didn't seem to affect the problem.

Here is some example code that will make it fail to respond:

import turtle
from turtle import forward, right, left

forward(50)

Answer

aengelberg picture aengelberg · May 30, 2012

I had the same problem (I was on Win 7 as well, and I then got the same problem on Win XP), and I just figured it out.

You have to say turtle.done() when you're done.

Now that I know this, it makes more sense, because since Python doesn't know that the turtle is done, it's probably waiting for another command for the turtle.

Here's the documentation (in Python 2.7) of what library I assume you're using. It's how I figured that out. It says Python 2.7 but this also works for Python 2.5.
http://docs.python.org/library/turtle.html

Hope that helps (for you or anyone else reading this),
Alex