turtle.exitonclick()Python (original) (raw)

Last Updated : 25 Aug, 2025

turtle.exitonclick() method is used in the Turtle graphics module to keep the drawing window open until the user clicks inside it. Unlike turtle.done(), which leaves the window open indefinitely, exitonclick() binds the bye() function to a mouse click, so the window will close only when clicked once.

**Syntax

turtle.exitonclick()

**Example :

python `

import turtle

for i in range(3): turtle.circle(40) turtle.right(120)

turtle.exitonclick()

`

**Output :

**Explanation:

**Related Articles