This project started as a keylogger that would allow me to visualize the keys I am pressing as I type. This is something I need, as I am in the process of learning both a new keyboard layout (ferris sweep) and a new keymapping (ISRT). I built the keyboard myself and used blank keycaps, so I was looking tool to make the learning process easier and decided to write my own.
I used the keyboard library to grab the key events and tkinter for the overlay. Once the simple scrolling text logger was competed, I extended it to include an expandable section with a visual representation of the keyboard. This portion uses keymap json files (i.e. those downloadable from QMK Configurator) alongside layout json files (as found in the QMK Firmware github repo) and creates a virtual keyboard complete with the correct layout in the expandable section. It additionally provides radio buttons to toggle between layers of the keyboard.
The final step was to parse the keyevents from keyboard and change the color on the virtual keyboard to reflect the state of the active keys. The solution to this is very half baked and only functions maybe 60% of the time. One issue is that the messages that keyboard sends sometimes do not correspond will to what qmk expects. For example, on my second layer, I have many of the number row symbols (@,#,etc...) mapped to individual keys (rather than being on the shift layer of the number keys). However, when I press, for example, @ on my keyboard, the key events registered by keyboard are separate and 2 events.
At this point, my desire to not deal with reconciling these issues, as well as my disinterest in continuing to use tkinter, far outweight my desire to polish this tool, which will only be useful to me for (hopefully) a short while longer. As such, I have no current plans to mak eany more changes.