My turtle should go direction which I show but there is a problem. When I press a key the turtle moves 10 and if I hold to press the key sometime it doesn't move. I want to change the turtle so that if my fingers are on a key it should keep moving
from turtle import Turtle
import turtle
STARTING_POSITION = (0, -260)
MOVE_DISTANCE = 20
screen = turtle.Screen()
screen.setup(width=900, height=600)
class Board(Turtle):
def __init__(self):
super().__init__()
self.shape('square')
self.hideturtle()
self.shapesize(1, 6, 1)
self.penup()
self.goto(STARTING_POSITION)
self.showturtle()
self.speed("fast")
def move_left(self):
if self.xcor() > -390:
self.back(MOVE_DISTANCE)
def move_right(self):
if self.xcor() < 390:
self.forward(MOVE_DISTANCE)
def go_to_start(self):
self.goto(STARTING_POSITION)
board = Board()
screen.listen()
screen.onkey(board.move_left, "Left")
screen.onkey(board.move_right, "Right")
screen.mainloop()