import turtle
kame = turtle.Turtle("turtle")
def moveKame(x, y):
kame.goto(x, y)
kame.screen.onclick(moveKame)
turtle.done()
#Load the turtle module
import turtle
#Create and store a Turtle in the turtle module in a variable named kame
kame = turtle.Turtle("turtle")
#Define a function named moveKame
#def means that it will generate a function
#moveKame can be any name
# x,y is the value of the coordinates clicked with the mouse
def moveKame(x, y):
#Move the turtle
kame.goto(x, y)
#Register a mouse click event. (The moveKame function is executed when the mouse is clicked.)
kame.screen.onclick(moveKame)
#Do not close the window immediately when running the program.
turtle.done()
Recommended Posts