[Tkinter-discuss] Making a keyboard

Bob Greschke bob at passcal.nmt.edu
Thu Jan 18 00:48:02 CET 2007


I'm making a popup keyboard for some touchscreen input.
I have, for example, got:

     Button(KBFrm, text = "1", command = Command(kbhit, "1")...


     def kbhit(K, e = None):
         Root.event_generate("<"+K+">")
         return


The letter keys work OK, but in the number keys 1 through 5 don't  
seem to do anything, but 6-9 and 0 work.  Looking at e.keysym and  
e.keysym_num in a whole other routine says that the 1 key on a  
keyboard generates 1, and 49, so I don't get what is going on.  Are  
<1> through <5> some kind of shortcuts for mouse button stuff?

Also, is there something like a dictionary in the system where I can  
get the keysym for the punctuation keys like

     KeySyms["$"] = "dollar"

or do I have to make one myself?

Thanks!

Bob



More information about the Tkinter-discuss mailing list