Python Forum
[PyGame] Keyboard input on Android
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Keyboard input on Android
#1
Hello,
I am creating a simple game using pygame on Android platform and I am not able to receive any key events except for ESCAPE and arrow keys (the arrow keys have very special numerical codes that I had to detect first). But I need to use also the W, S, A, D keys in this game. I use physical keyboard connected to an android tablet using the bluetooth.
Thanks
Reply
#2
(Jun-07-2025, 05:56 PM)nooryasmeen022 Wrote: Hi! The issue you’re facing is common because Android’s input handling can differ significantly from desktop environments—Bluetooth keyboards sometimes send unique keycodes that Pygame may not interpret by default. You might want to capture raw keycodes and map them manually or use alternative input detection methods to get keys like W, A, S, and D working properly. Also, during long coding sessions, having a simple food menu planned can really help keep your energy up and stay focused. Hope this helps!

Hi, thank you for your respone. In fact, I have used the capture method to identify the arrow key codes, but no other keys except for ESAPE is returning any codes. I mean that I get no codes on any other keys on the bluetooth keyboard using the pygame.key.get_pressed() function not even any pygame event is generated for any other keys.
What should I do to detect other keys on bluetooth keyboard connected to Android tablet?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Shapes dont respond to keyboard input Mechanicalpixelz 3 3,246 Dec-25-2021, 03:23 AM
Last Post: Mechanicalpixelz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020