Click here to Skip to main content
15,311,151 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?

What I have tried:

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

OK,I thought something and I did it with some if statements
You don't "disable keys". That's just not a thing.

You simply ignore the keys you're not interested in.

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

  Print Answers RSS

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