Python Forum

Full Version: Send Key press for a game?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm just trying to send simple key commands to a video game. I've tried a few different pypi options and pywin32 to send keystrokes. pynput send mouseclicks but not keystrokes. Though all of these will send to something like notepad, keystrokes aren't showing up in game.

Any ideas?
what game? What is your code for each various library?
The game is EverQuest.
pynput for example. Again, the code works fine everywhere except on top of this game. Even when it's called to the forefront. The pynput mouse movement and clicks work great, not the keys though. I'm not sure if there is a 'lower level' key send option I need to use or what is available.
from pynput.keyboard import Key, Controller

keyboard = Controller()

# Type a lower case A; this will work even if no key on the
# physical keyboard is labelled 'A'
keyboard.press('a')
keyboard.release('a')
AutoHotKey might be easier to do this with: https://www.autohotkey.com/