I'm using mpl in a wxPython application to display plots dynamically. I want
to let the users interact with the plots (zoom, move), but I don't need the
"subplot configuration" button on the Navigation Toolbar. Can I instantiate
the toolbar without this button ?
Yes. I did this by deriving my toolbar class from the default NavigationToolbar2WxAgg. Then deleting the buttons I did not want. I had to delete by position, because I did not know their IDs. (Does anyone know how to get the IDs of these standard buttons?) Sample code below:
# delete unwanted tools
self.DeleteToolByPos(1) # Back Arrow
self.DeleteToolByPos(1) # Forward Arrow (note this was position 2)
self.DeleteToolByPos(3) # Divider (this was position 5)
self.DeleteToolByPos(3) # Configure subplots (this was position 6)
... #end __init__ #end class
I'm using mpl in a wxPython application to display plots dynamically. I want
to let the users interact with the plots (zoom, move), but I don't need the
"subplot configuration" button on the Navigation Toolbar. Can I instantiate
the toolbar without this button ?
Alternatively, you can follow the lead of
examples/user_interfaces/embedding_in_wx4.py which uses a custom
toolbar. You can cut the NavigationToolbar2 code from backend_wx.py
and remove the bits you don't want.
JDH
···
On Thu, Jul 31, 2008 at 8:18 AM, Ben Axelrod <baxelrod@...2066...> wrote:
Yes. I did this by deriving my toolbar class from the default NavigationToolbar2WxAgg. Then deleting the buttons I did not want. I had to delete by position, because I did not know their IDs. (Does anyone know how to get the IDs of these standard buttons?) Sample code below: