how to suppress further processing of matplotlib event
<p>I'm building an interactive graphical application with matplotlib.  I want it to play nice with the existing "pan" and "zoom" functions of the default matplotlib GUI, but I also want to overshadow some keystrokes.  My problem is that I don't know to suppress the GUI's default response to those keystrokes. For example, the GUI responds to the backspace key by stepping back one view in the history: I want to replace this behaviour with my own custom behaviour:</p>

<pre><code>def KeyUp(event):

    if event.key.lower() == 'backspace':
        RespondToBackspace()
        PreventAnybodyElseRespondingToBackspace()  # HOW??

import matplotlib.pyplot as plt
cid = plt.gcf().canvas.mpl_connect( 'key_release_event', KeyUp )
</code></pre>

<p>I can find no documentation on cancelling or suppressing event processing and have run out of creativity on my search terms.  Speculatively, thinking that this mechanism will work as it does in some other toolkits, I tried returning either <code>True</code> or <code>False</code> from the callback, without effect (i.e. the "step back one view" behaviour still happens, along with my custom response, when I press backspace).</p>

<p>Is this possible?</p>

<p>From tacaswell's comments above:</p>

<p>Callbacks are stored in a dictionary so the order in which they get called cannot be guaranteed. Callback return values are ignored.</p>

<p>The solution is to change <code>matplotlib.rcParams['keymap.back']</code> so that it does not include <code>'backspace'</code>.</p>

python matplotlib