Skip to content Skip to sidebar Skip to footer

Turtle Window Exit Errors

When I click out of my turtle window it spits 24 lines of errors to the shell. The error report ends with turtle.Terminator. turtle.Terminator is not an exception so I can't hand

Solution 1:

You want to use the window's native close button (eg. the red X in OSX) to close the window while your turtle code is running. You end up with lots of error messages to the terminal. The following approach allows me to cleanly close the window without error messages:

import turtle

# put all your variable and function definitions heretry:

    # put all the setup code you invoke here

    turtle.exitonclick()  # or mainloop() or done()except Exception:
    pass

Now when you close the window, you'll get no error messages. Clearly only do this to a finished, fully debugged program otherwise you'll miss error messages you really want to see...

Post a Comment for "Turtle Window Exit Errors"