Much like the Makey Makey, or an Arduino Leonardo, using a Raspberry Pico with CircuitPython we can prepare a device to behave like a keyboard when connected to a computer.
You must use CircuitPython 7.0.0 or higher in order for the included codes to work. After installing CircuitPython on the Pico, simply copy the codes boot.py and code.py to the device. Also copy the entire folder titled adafruit_hid. With several buttons wired up to designated pins you should immediately see results after unplugging, re-plugging the Pico and opening a basic text editor on your computer.
All pins and keyboard character mapping are found in the file code.py
All buttons/switches added to the device are to be connected to ground. Internal Pull-Up resistors are activated in the code, so no need to add them in your circuit
You will need to add a button to GPIO pin 0. To edit your code on the Pico, this pin must be pulled LOW when connecting the device to your computer. Otherwise you will be locked out and the device will behave only as a keyboard.
adafruit_hid module for CircuitPython (github page)
adafruit: customizing usb devices in circuit python