R. Toward
1
Q:

python turtle onkeypress

#Importing the module
import turtle

#The window creation
window = turtle.Screen()

#The turtle creation
p = turtle.Turtle()
p.color("black")
p.penup()

#the function
def move():
  p.forward(20)

#The event listener
turtle.listen()
turtle.onkeypress(move(),"w")
4

New to Communities?

Join the community