Skip to content

Commit

Permalink
Merge pull request #2696 from cgohlke/patch-3
Browse files Browse the repository at this point in the history
Fix Tk keyboard modifier masks on Windows
  • Loading branch information
pelson committed Jan 8, 2014
2 parents d1dd52a + cb6e75c commit 19b3598
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/matplotlib/backends/backend_tkagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,20 @@ def _get_key(self, event):
# 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.
modifiers = [(6, 'super', 'super'),
(3, 'alt', 'alt'),
(2, 'ctrl', 'control'),
]
if sys.platform == 'darwin':
if sys.platform == 'win32':
modifiers = [(17, 'alt', 'alt'),
(2, 'ctrl', 'control'),
]
elif sys.platform == 'darwin':
modifiers = [(3, 'super', 'super'),
(4, 'alt', 'alt'),
(2, 'ctrl', 'control'),
]
]
else:
modifiers = [(6, 'super', 'super'),
(3, 'alt', 'alt'),
(2, 'ctrl', 'control'),
]

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

0 comments on commit 19b3598

Please sign in to comment.