import matplotlib import matplotlib.pyplot as plt print matplotlib.__version__ print plt.get_backend() def key_event(e): print e.key fig = plt.figure() fig.canvas.mpl_connect('key_press_event', key_event) plt.show() I'm interested in key press event handlers with modifiers (e.g. Ctrl, Alt, Shift) in matplotlib/pyplot. This part of the docs mentions some support for modifiers. But when I use the code above I don't see that behaviour.
I would prefer to avoid having to handle the modifiers manually with maintaining state about those key press / release events; for example, I want to be able to easily distinguish between a and ctrl+a without having to maintain a state about control up/down.
-Am I missing some higher level interface somewhere, where modifiers just work?
-Or perhaps that part of the docs only applies to GTKAgg backend, when I generally use TkAgg?
-Maybe the support for modifiers perhaps something which was added recently, and isn't in my matplotlib version 1.1.1rc?
matplotlib.use('TkAgg')(using matplotlib 1.2).