From 17466c136922dde6e8d9c9b3471d83c5c30a4896 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 25 Feb 2021 15:19:59 +0100 Subject: [PATCH] Fix "return"->"enter" mapping in key names. All backends previously normalized both the return key and the (numpad) enter to "enter" (see e.g. the presence of two "enter" entries in the old FigureCanvas{GTK3,Tk}.keyvald . When revamping the gtk and tk key names lookup I accidentally normalized both to "return" instead, so fix that. Test with ``` gcf().canvas.mpl_connect("key_press_event", lambda e: print(e.key)) ``` --- lib/matplotlib/cbook/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index df1830e9ad2e..79da52c7434c 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -2308,7 +2308,7 @@ def _unikey_or_keysym_to_mplkey(unikey, keysym): if key.endswith(("_l", "_r")): # alt_l, ctrl_l, shift_l. key = key[:-2] key = { - "enter": "return", + "return": "enter", "prior": "pageup", # Used by tk. "next": "pagedown", # Used by tk. }.get(key, key)