Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

keypad number presses not properly registered by tk #9493

Open
@anntzer

Description

@anntzer

Bug report

Bug summary

Pressing keypad numbers do not report keys correctly under tkagg+linux, if numlock is active (i.e. when numbers should be reported); numbers are incorrectly reported when numlock is inactive (i.e. when numbers shouldnot be reported).

Code for reproduction

MPLBACKEND=tkagg python -c 'from pylab import *; gcf().canvas.mpl_connect("key_press_event", lambda event: print(event.key)); show()'

Actual outcome

numbers are printed when numlock is inactive, and vice versa.

Expected outcome

the opposite

Matplotlib version

  • Operating system: ubuntu
  • Matplotlib version: 2.0.2 (but likely irrelevant
  • Matplotlib backend (print(matplotlib.get_backend())): tkagg
  • Python version: 3.6
  • Jupyter version (if applicable):
  • Other libraries:

This is due to FigureCanvasTkAgg.keyvald using incorrect values for the mapping: it uses the values athttp://infohost.nmt.edu/tcc/help/pubs/tkinter/web/key-names.html (KP_0, etc.) but the correct values (in the tk sources themselves...) are athttps://github.com/tcltk/tk/blame/a1577313301d5ad9a6e553b359f7e5de2b8f6153/generic/ks_names.h (themselves derived fromhttps://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h) and suggests that the numlock state got inverted.

On Windows this is irrelevant, keypad presses are reported with a keyval_sym <256 and thus directly converted via ASCII to the correct value. Not sure about the situation under OSX.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp