You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How do I disable the Esc key from closing raw.plot? #6425
In MNELAB, I would like my raw.plot window to not close if the user hits the Esc key. Previously, I used the following hack which worked for matplotlib < 3:
Of course this was bound to fail, and with matplotlib >= 3 key_events is now a matplotlib.cbook._StrongRef object, whereas previously it used to be a matplotlib.cbook._BoundMethodProxy object. Of course private methods can change at anytime, but does anyone know either how to make the old hack work again, or better yet how to modify/delete existing callbacks?
Yes, why not? If this gives an interface where I can change/delete callbacks... But once a callback is set, would adding our params solve the issue? Isn't a matplotlib call necessary to change a callback? If so, which?
Isn't a matplotlib call necessary to change a callback? If so, which?
It depends what you mean. If you mean removing or adding a callback function yes you have to use mpl. If you just want to make it so that the existing mne callback does nothing on esc, it should be enough to do fig._mne_params['close_key'] = None.
Activity
larsoner commentedon Jun 6, 2019
I wonder if we should just monkey patch to add an attribute to
figasfig._mne_params = paramscbrnr commentedon Jun 6, 2019
Yes, why not? If this gives an interface where I can change/delete callbacks... But once a callback is set, would adding our params solve the issue? Isn't a matplotlib call necessary to change a callback? If so, which?
larsoner commentedon Jun 6, 2019
It depends what you mean. If you mean removing or adding a callback function yes you have to use mpl. If you just want to make it so that the existing
mnecallback does nothing onesc, it should be enough to dofig._mne_params['close_key'] = None.