Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.I build the Snake game (in Python) using arrow keys and I want to disable all the keys except Up,Down,Right,Left.For example, if user push the space bar ,I don't want to happen anything.I hope I'm clear.How can I do it?
Thanks.

What I have tried:

Just a question...................
Posted
Updated 16-May-21 5:45am

You don't "disable keys". That's just not a thing.

You simply ignore the keys you're not interested in.
 
Share this answer
 
OK,I thought something and I did it with some if statements
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900