How to pass a "key_release_event" to Matplotlib?

Hi everybody,

I am working on a program that incorporates a matplotlib plot into a wxPython GUI, and I am having trouble with key press events in the matplotlib plot. You’re supposed to be able to check which keys are pressed while clicking on a plot element (which generates a matplotlib “pick_event”), but I am getting some strange persistence effects. (For example, once I’ve used the “CMD+O” shortcut to open a file in my program, matplotlib keeps telling me that I have the command key pressed, even when I am doing just a normal click on the plot.)

The problem seems to be that some of my key press events “end” in other windows - e.g. the “CMD+O” open file event ends with a “Open file” dialog, or an “ALT-click” event can end with a warning wx.Message box that there is no new data to display - and that the release of the key in question seems to be “eaten” up by these windows. That is, matplotlib never gets the message that the key was released, and on the next click is still telling me that the key is pressed, even when it is not.

Now my question is, how do I send a key release event back to matplotlib? I have tried to add “event.Skip()” to the handlers that cause the “dead end” problem, but python is telling me that “PickEvent instance has no attribute ‘Skip’”.

Any ideas would be greatly appreciated.

Many thanks,

Ingrid