Skip to content
Advertisement

Add toolbar button icon matplotlib

I want to add an icon to a custom button in a matplotlib figure toolbar. How can I do that? So far, I have the following code:

JavaScript

For now, the only thing that it does is adding a new button (which do what I want) but the icon is only the tool’s name i.e.: “newtool”. How can I change this for a custom icon like a png image?

Advertisement

Answer

The tool can have an attribute image, which denotes the path to a png image.

JavaScript

enter image description here

Advertisement