1

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.

Omegastick
  • 1,773
  • 1
  • 20
  • 35
  • 1
    There seem to be a scancode dictionary already defined inside the [source code](https://programtalk.com/vs2/python/8562/pyvbox/virtualbox/library_ext/keyboard.py/) And if you wish to see the codes, you may use [xev](https://linux.die.net/man/1/xev) if you are on linux and try out various keys. – thuyein Jun 03 '19 at 03:00
  • @ThuYeinTun So there is. If you post that as an answer you can have the bounty. – Omegastick Jun 03 '19 at 04:11
  • Thank you. I've posted it as an answer. – thuyein Jun 03 '19 at 04:19
  • @ThuYeinTun I have to wait 22 hours before I can give the bounty. I'll give it then. – Omegastick Jun 03 '19 at 04:20

1 Answers1

1

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.

thuyein
  • 1,684
  • 13
  • 29