Python Turtle - Is it possible to prevent the crash at the end
<p>this is my code. I am using the turtle module to just write some text on the screen for a project for school. But whenever I do this, the program crashes/stops responding and I was wondering if it is possible to prevent this from happening.</p>

<pre><code>import turtle

screen = turtle.Screen()
screen.screensize(500, 500, "pink")

drawingpen = turtle.Turtle()
drawingpen.color("black")
drawingpen.penup()
drawingpen.setposition(-300, -300)
drawingpen.pendown()
drawingpen.pensize(3)
for side in range(4):
    drawingpen.forward(600)
    drawingpen.left(90)

drawingpen.hideturtle()    

y = 243

for x in range(10):
    drawingpen.penup()
    drawingpen.color("black")
    drawingpen.setposition(0, y)
    drawingpen.pendown()
    drawingpen.write("Test", False, align="center", font=("Arial", 18, "normal"))
    drawingpen.hideturtle()
    y = y - 57
</code></pre>

<p>Your code hasn't crashed, it just ran out of code to process. The code that is there is working fine and as expected.</p>

<p>To see what I mean add:</p>

<pre><code>print("END") #Python 3
print "END"  #Python 2
</code></pre>

<p>to the end of your code. You will see the console prints the word "END" after your text is finished printing.
But a nicer way might be to add:</p>

<pre><code>screen.exitonclick()
</code></pre>

<p>to the end. This will close the window when you click on it.</p>

python python-2.7