s.onkey(function, key) where s is the screen object, function is the function to execute and key is the key to test.
Right Arrow = 'right'
Left Arrow = 'left'
Up Arrow = 'up'
Down Arrow = 'down'
Note: Do not include the parenthesis in the onkey() function argument.
Correct = s.onkey(func, key)
Incorrect = s.onkey(func(), key)
@Geocube101 for me it says "Error: name 's' is not defined on line __". I tried doing "import s", but there's no module named s. Btw I am working on Python turtle.
s.onkey(function, key)
wheres
is the screen object,function
is the function to execute andkey
is the key to test.Right Arrow = 'right'
Left Arrow = 'left'
Up Arrow = 'up'
Down Arrow = 'down'
Note: Do not include the parenthesis in the
onkey()
function argument.Correct =
s.onkey(func, key)
Incorrect =
s.onkey(func(), key)
@Geocube101 for me it says "Error: name 's' is not defined on line __". I tried doing "import s", but there's no module named s. Btw I am working on Python turtle.
@RainbowBoy7324
s
is a variable for the turtleScreen
objectTurtle Screen documentation can be found here