pythonkeyboardvirtualboxscancodes

Convert string to scancodes for pyvbox


I'm trying to use pyvbox to enter some text into a virtual machine, but it takes keyboard input as a list of keyboard scancodes. I'd like to convert a regular Python string into a list of scancodes.

I'm aware that I could probably brute force it by trying each scancode and seeing what I get, but I wondered if there's a library or similar out there. AFAIK, scancodes are keyboard layout dependant, so it would presumably need to be configured with a keyboard layout.


Solution

  • There seem to be a scancode dictionary already defined inside the source code And if you wish to see the codes, you may use xev if you are on linux and try out various keys.