Ask coding questions

← Back to all posts
Python arrow key input
JakobNacanaynay

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

Voters
gregmarks1
MalMal357
JakobNacanaynay
Comments
hotnewtop
Barry123

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

skyscraper1492

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

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

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.

JakobNacanaynay
YuAndy

@Four_Of_Clubs It works only when you import turtle right?