Ask coding questions

← Back to all posts
Python arrow key input
JakobNacanaynay (36)

How to you get python to detect an arrow key? How do you make it react immediately without having to press ENTER.

Comments
hotnewtop
Barry123 (350)

If you are using turtle:
Import turtle
screen=turtle.Screen()
#Define a function here
while True:
screen.onkey(That_function, key)

skyscraper1492 (1)

Hmmm. I was also trying to use arrow keys. But it didn't work for me either.

ColePete (30)

If I could see you code, that would be helpful. But, you could just have it print("insert something here") again. Or, you can use time and tell it to wait a few seconds, and then continue. If you give me the code, I could show you. @JakobNacanaynay

Four_Of_Clubs (96)

I know this is like super late, but the onkey() function is what you are looking for. There are some other steps though, so it might help to look at the code made by other people and use the power of google to help.

YuAndy (75)

@Four_Of_Clubs It works only when you import turtle right?