Home > Net >  How to change color of matplotlib toolbar in tkinter?
How to change color of matplotlib toolbar in tkinter?

Time:11-14

I would like to change the color of the toolbar when making a matplotlib figure in tkinter. I have managed to find and change the color of two parts. There is one remaining.

My code comes directly from Plot window with the bit I still want to change pointed out

What is the small, grey rectangle I have pointed out? How do I change its color?

CodePudding user response:

It is an empty label. You can get a reference to it via winfo_children:

print (toolbar.winfo_children()[-2])

# .!navigationtoolbar2tk.!label

And to change its color:

toolbar.winfo_children()[-2].config(background=color)
  • Related