Skip to content

Commit cb6e75c

Browse files
committed
Fix Tk keyboard modifier masks on Windows
1 parent 3284b17 commit cb6e75c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,20 @@ def _get_key(self, event):
453453
# In general, the modifier key is excluded from the modifier flag,
454454
# however this is not the case on "darwin", so double check that
455455
# we aren't adding repeat modifier flags to a modifier key.
456-
modifiers = [(6, 'super', 'super'),
457-
(3, 'alt', 'alt'),
458-
(2, 'ctrl', 'control'),
459-
]
460-
if sys.platform == 'darwin':
456+
if sys.platform == 'win32':
457+
modifiers = [(17, 'alt', 'alt'),
458+
(2, 'ctrl', 'control'),
459+
]
460+
elif sys.platform == 'darwin':
461461
modifiers = [(3, 'super', 'super'),
462462
(4, 'alt', 'alt'),
463463
(2, 'ctrl', 'control'),
464-
]
464+
]
465+
else:
466+
modifiers = [(6, 'super', 'super'),
467+
(3, 'alt', 'alt'),
468+
(2, 'ctrl', 'control'),
469+
]
465470

466471
if key is not None:
467472
# note, shift is not added to the keys as this is already accounted for

0 commit comments

Comments
 (0)