New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On linux, numeric pad input is ignored when numlock off #41237
Comments
The behaviour of the direction keys on the numpad is How reproducible: Steps to Reproduce:
Actual Results: Intense frustration for people who Expected Results: When numlock is off, the direction I am reporting this for Python 2.3, but I had exactly This problem has also been reported to RedHat, see |
Logged In: YES In RedHat bugzilla, this problem was reported for fedora |
Logged In: YES Kurt, as far as I can tell, there is nothing in Tkinter that |
Logged In: YES Yes, if OP wants to pursue it, he should take it up with the |
Logged In: YES
Thanks, netvigator aka Rick Graves |
Logged In: YES OP = opening poster. So yes, the ball is in your court. :) |
Logged In: YES I posted the "bug" on the Tk list as suggested. Today I got this: begin quote
Message: This is not a bug, but rather just that Tk differentiates IOW, the bindings should be on <Up> and <KP_Up> if they are ---------------------------------------------------------------------- You can respond by visiting: end quote Would someone please either reopen this or let me know what my Thanks, Rick |
Logged In: YES OK, thanks for the leg work. I'll take a further look. My keyboards are IBM Model M SpaceSavers. I don't |
Confirmed in trunk, the <KP_Up> (80) events show in a terminal if one |
Unfortunately this is not that easy for us, while we could add some code import Tkinter
text = Tkinter.Text()
text.event_add("<<Up>>", "<Key-Up>")
text.event_add("<<Up>>", "<Key-KP_Up>")
text.bind_class("Text", "<<Up>>", text.bind_class("Text", "<Key-Up>"))
text.pack()
text.mainloop() it won't work as most would expect. When numlock is on, it would still |
Ah yes, here is something that would do what we wanted (for "up" only): import Tkinter
def my_up(event):
widget = event.widget
if event.keysym == 'KP_Up' and event.state & 16:
widget.tk.call('tk::TextInsert', widget, event.char)
return "break"
pos = widget.tk.call('tk::TextUpDownLine', widget, -1)
widget.tk.call('tk::TextSetCursor', widget, pos)
text = Tkinter.Text()
text.event_add("<<Up>>", "<Key-Up>")
text.event_add("<<Up>>", "<Key-KP_Up>")
text.bind_class("Text", "<<Up>>", my_up)
text.pack()
text.mainloop() |
I verified that this issue does not affect Windows. What about Mac? A patch might best be system-specific in only being active on systems that need it. The lack of complaints other than by one person suggests that it is not a high priority among linux users -- or that they are all resigned to flakey behavior, or that some other linux apps also do not recognize numlock-off keypad keys. |
Summary: (Graves, msg23356, 2004-12-24) tk event for keypad keys depends on system keymap. Windows: numlock off, keypad up (8) is <up>. Linux: same is <kp-up> and Text does *not* see this as <up> In the absence of more contemporary complaints by Linux users, closing. |
There is any way for making the Home key from keypad (KP_Home) to work just like the normal Home key with IDLE shell/editor? And the same to KP_End, KP_Prior (PageUp) and KP_Next (PageDown). The KP_Home, KP_End, KP_Prior and KP_Next keys doesn't work with IDLE on Linux (I didn't test it on MS Windows). The expected behavior is the KP_Home to move the keyboard cursor to the begin of the line and the KP_End to move to the end of the line, just like Home and End keys. Ctrl + KP_Home should move to the begin of the file and Ctrl + KP_End should move to the end of the file. Shift modifier should be used to select text together with any of those keypad keys. But it depends on keyboard layout, for some (or most) keyboard layouts on Linux, Shift modifier will return a number when used together with keypad keys. For my keyboard layout Shift only modify the keypad keys if NumLock is active, so the expected behavior is that it triggers text selection. Those expected behaviors works for almost any non TKinter applications on modern Linux desktops, ie, works on GTK or QT based software. As already discussed for this bug, TK will not change it's own default behavior, since this is the desired behavior for some use cases. That said, I ask, please, that this bug is re-opened |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: