key_press_event behaviour differs with backend


This is an extended version of the problems I reported yesterday to the user listserv here:

The basic problem is that key press events for the navigation keys ('up, ‘down’, ‘left’, ‘right’, ‘pageup’, and ‘pagedown’) are handled differently for different backends. This leads to different behaviour when code is run on a different backend.

Here are my observations:

Tk: -all navigation keys yield the correct event.key values.

-nav keys are not bound to interactive toolbar

Qt4: -navigation keys all yield ‘none’

-nav keys are not bound to the interactive toolbar

GTK: -navigation keys yield the correct event.key values

-the nav keys are bound to the interactive toolbar, but in an inconsistant manner. If the toolbar zoom has not been used then up, left, and right keys all send events to the connected key handler. If the toolbar zoom has been used then left and right scrolls through the zoom levels. Pressing the ‘down’ key selects the interactive toolbar, further presses of any key are no longer sent to the connected key_press_event callbacks, but they do change the selected tool. The zoom behaviour of the left and right keys can be removed by unconnecting the toolbar’s key_press_event handler. But, this does not change that of the down key: whatever selects the toolbar upon pressing the ‘down’ key is at a lower level than matplotlib.

This seems like bad behaviour. My impression has been that code should work equally well with all backends.

For my application, my preferred backend is GTK, but my desired behaviour is that of Ag. Can anyone recommend how to get GTK to not select the toolbar with the down key (while keeping the toolbar)?

Thanks for your help,