Skip to content

Commit 7100e9e

Browse files
authored
Merge pull request #25131 from greglucas/modifier-tk
FIX: Correctly report command keypress on mac for Tk + Gtk
2 parents 6820797 + 8ba4814 commit 7100e9e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def _mpl_modifiers(event, *, exclude=None):
354354
("ctrl", 1 << 2, "control"),
355355
("alt", 1 << 4, "alt"),
356356
("shift", 1 << 0, "shift"),
357-
("super", 1 << 3, "super"),
357+
("cmd", 1 << 3, "cmd"),
358358
] if sys.platform == "darwin" else [
359359
("ctrl", 1 << 2, "control"),
360360
("alt", 1 << 3, "alt"),

lib/matplotlib/cbook.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,9 @@ def _unikey_or_keysym_to_mplkey(unikey, keysym):
21692169
key = key.replace("page_", "page")
21702170
if key.endswith(("_l", "_r")): # alt_l, ctrl_l, shift_l.
21712171
key = key[:-2]
2172+
if sys.platform == "darwin" and key == "meta":
2173+
# meta should be reported as command on mac
2174+
key = "cmd"
21722175
key = {
21732176
"return": "enter",
21742177
"prior": "pageup", # Used by tk.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy