I’m working on a Python Turtle graphics program and I’m trying to use the exitonclick
method to close the window when it’s clicked. However, it doesn’t seem to be working.
from turtle import Turtle, Screen
rem = Turtle()
screen = Screen()
rem.fd(70)
def clear():
screen.clearscreen()
screen.listen()
screen.onkey(fun=clear,key = "c")
screen.exitonclick()
When i run it and try to exit the programme by clicking on the screen nothings happen.
New contributor
Ayush Dey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1