Skip to content
Sign upLog in
← Back to Community

Python arrow key input

Profile icon
JakobNacanaynay

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

Voters
Profile icon
gregmarks1
Profile icon
MalMal357
Profile icon
JakobNacanaynay
Comments
hotnewtop
Profile icon
Barry123

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

Profile icon
skyscraper1492

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

Profile icon
ColePete

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

Profile icon
Four_Of_Clubs

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.

Profile icon
JakobNacanaynay

@Four_Of_Clubs thanks

Profile icon
E-Sheep

@Four_Of_Clubs It works only when you import turtle right?