2

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.

http://taufanlubis.wordpress.com/2008/04/19/gtkeyboard-%E2%80%93-on-screen-keyboard-for-linux/

James Young
  • 313
  • 3
  • 10
  • 19
  • You can use Tkinter to grid a keyboard to the screen. Its your best bet unless you find some predefined on screen keyboard modules. – sshashank124 Mar 19 '14 at 23:06

2 Answers2

0

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

8) Profit

asdf
  • 2,927
  • 2
  • 21
  • 42
0

I had the same problem and did not find an appropriate solution other than creating (or at least heavily improving) one myself. I used

petemojeiko's virtual keyboard on GitHub

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.

Fantilein1990
  • 155
  • 1
  • 6