Deactivate pan function

Hi all.
For an app in wxpython, I associated the pan function from the toolbar given by
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar
self.toolbar = NavigationToolbar(self.panel.canvas)

Is there a way to deactivate my pan mode ?

Somewhat confusingly, you call it a second time!

This method was designed to be registered onto the “clicked” callback of a GUI button so everytime you call it, it acts as a toggle (see the source ). @Beldramma Would you be willing to open a Pull Request to clarify the docstring?

What did I call a second time ?If you are talking about the other post “Pan/zoom function in matplotlib”, for me it’s not the same question, that’s why I posted this second one. About your answer, is there a function in the toolbar, to deactivate pan mode ?

Sorry for not being clear.

To turn “pan” off you call toolbar.pan() a second time. Take a look at the linked source in my previous post.

Oh Ok, thanks, I will check.

Is there a variable to check if the pan mode is on or off ?

With the doc you gave me, I found that with the attribute self.toolbar._active, I can know if the pan mode is on. I have just one “problem” : I would like to know how to change the cursor icon in zoom mode.

I strongly advise against relying on attribute prefixed with _underscore as we consider those private and may change their behavior with no warning in any release.

To change the cursor I think you want the set_cursor method on the toolbar.

I just check the value of _active, if it is ‘PAN’, I launch the pan method one more time.