0

I added a toolbar button with an icon as explained here: Add toolbar button icon matplotlib. It worked for a while, then it stopped and I am at a loss to understand why. It just shows the name now. Can someone explain what the 'r' is for before the image filename? I've also tried sending in the whole path to the image file with and without the 'r' - it still didn't work. Thank you!

Here's the code:

class zoominTool(ToolBase):
  '''zoomin by 10%'''
  default_keymap='+'
  description = 'Zoom in 10 percent'
  image = r'./zoomin.png'
  name = '+'

1 Answer 1

0

I figured it out, kind of. I tried changing the backends. If I set it to TkAgg, my icons appear. If I set it to Qt4Agg or Qt5Agg, I get text.

import matplotlib
matplotlib.use('TkAgg')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.