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

option+letter on OSX with tkagg give non-alpha numeric rather than alt-<letter> #22934

Open
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGUI: MacOSXGUI: tkGood first issueOpen a pull request against these issues if there are no active ones!
@tacaswell

Description

@tacaswell

This issue is restricted to:

  • tk backend
  • on OSX

self._tkcanvas.bind("<Key>",self.key_press)

to

defkey_press(self,event):
key=self._get_key(event)
FigureCanvasBase.key_press_event(self,key,guiEvent=event)

to

def_get_key(self,event):
unikey=event.char
key=cbook._unikey_or_keysym_to_mplkey(unikey,event.keysym)
# add modifier keys to the key string. Bit details originate from
# http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
# BIT_SHIFT = 0x001; BIT_CAPSLOCK = 0x002; BIT_CONTROL = 0x004;
# BIT_LEFT_ALT = 0x008; BIT_NUMLOCK = 0x010; BIT_RIGHT_ALT = 0x080;
# BIT_MB_1 = 0x100; BIT_MB_2 = 0x200; BIT_MB_3 = 0x400;
# In general, the modifier key is excluded from the modifier flag,
# however this is not the case on "darwin", so double check that
# we aren't adding repeat modifier flags to a modifier key.
ifsys.platform=='win32':
modifiers= [(2,'ctrl','control'),
(17,'alt','alt'),
(0,'shift','shift'),
]
elifsys.platform=='darwin':
modifiers= [(2,'ctrl','control'),
(4,'alt','alt'),
(0,'shift','shift'),
(3,'super','super'),
]
else:
modifiers= [(2,'ctrl','control'),
(3,'alt','alt'),
(0,'shift','shift'),
(6,'super','super'),
]
ifkeyisnotNone:
# shift is not added to the keys as this is already accounted for
forbitmask,prefix,key_nameinmodifiers:
ifevent.state& (1<<bitmask)andkey_namenotinkey:
ifnot (prefix=='shift'andunikey):
key='{0}+{1}'.format(prefix,key)

is the call chain on our side. This makes me think that the conversion is happening before it gets to us (but someone with a mac should probably verify that).

Originally posted by@tacaswell in#22681 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGUI: MacOSXGUI: tkGood first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp