Python on screen keyboard
I am in the middle of creating a tablet for my RPI and i am i need of a way to control the keyboard from the screen so i think my best bet is an on screen keyboard.
My question is how would i go about doing this in python and what if any libraries would be useful for this?
I have found multiple on-screen keyboards for linux but i cannot seem to find an opensource one i can take a look at too see how it is built.
Are you familiar with tinter? I'm not going to get into too much detail, but here's an idea of how you could structure your code if you were to do it yourself.
1) Build a tkinter canvas where you want your keyboard
2) Build tkinter rectangles for each individual key (this is going to be a pain since you'll probably have to do each one manually).
3) Give all the rectangles the same tag
4) Create a dictionary containing the coordinates of each key and the corresponding letter/function.
5) Bind the tag created for each rectangle to the same function
6) Check event.x and event.y against your dictionary
7) Return the key that was pressed
I had the same problem and did not find an appropriate solution other than creating (or at least heavily improving) one myself. I used
as a starting point for creating my own solution (opensource and on GitHub). It needed to be usable in typing a complex password, so it sports keys for lower- and uppercase letters, numerals and (most) symbols a regular keyboard supports.