The Wayback Machine - https://web.archive.org/web/20231031082330/https://www.geeksforgeeks.org/python-turtle-done/
Open In App
Related Articles

Python – turtle.done()

Improve Article
Improve
Save Article
Save
Like Article
Like

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.done()

This function is used to starts event loop – calling Tkinter’s main loop function. It does not require any argument. Must be the last statement in a turtle graphics program. Must NOT be used if a script is run from within IDLE in -n mode (No subprocess) – for interactive use of turtle graphics.

Syntax : turtle.done() 
Parameters : None 
Returns : None 
 

Below is the implementation of the above method with some examples :

Example 1 : At the end.
 

python3




# import package
import turtle
 
# motion
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
 
# stop execution
turtle.done()


Output : 
 

Example 2 : Stop the execution at any step. 
 

python3




# import package
import turtle
 
# motion
turtle.circle(20)
turtle.circle(30)
 
# stop execution
turtle.done()
 
# motion
turtle.circle(40)
turtle.circle(50)


Output : 
 

 

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 20 Jul, 2021
Like Article
Save Article
Similar Reads
Related Tutorials