On 8/28/2017 7:20 PM, Irmen de Jong wrote:
Hi,
Using tkinter in python3, I was trying to intercept individual keypresses (and
releases)
of keys on the numeric keypad. I want to use this as a simple joystick
simulation.
While you can bind the <KeyPress> event, actually doing something sensible with
it in a
cross platform way seems utterly impossible.
The distinguishing attribute of the event object is different depending on what
OS
you're using (keysym, keycode, keysym_num) and on Windows registering some keys
doesn't
even seem to work (or they're confused with the same keys on the normal
keyboard area).
The keysym names/values in the documentation are not correct either
(I'm mainly looking at
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/key-names.html)
*The* documentation (for 8.6) is the tcl.tk/man doc set:
https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm
For the level of detail you are looking at, they are essential.
The nmt docs for 8.5 are neither complete (intentionally not) nor always
correct nor always up to date. The tk docs may also have errors, just
as our do, but I presume one can file a report somewhere and possibly
get a fix.
My original question with the details on stackoverflow:
https://stackoverflow.com/questions/45869902/better-way-to-deal-with-tks-keyboard-events-mess-for-numpad-keys-in-pythontkin
Unfortunately there hasn't been a useful response or answer.
A gist with a small example program is here:
https://gist.github.com/irmen/2c9d6bb0afb16b464805410c108a2885
Does anyone here have a clue perhaps?
Or have any idea why this is so messy?
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list