0

I'm going crazy trying to change the background color of the ttk.Treeview.Heading

I used:

s = ttk.Style()
s.configure('Treeview.Heading', background='black', foreground='dark blue')

The foreground changes no problem, but the background won't change. I've searched around and found a few bugs with the background for the normal Treeview rows, but I'm not sure if this is related to that as well.

Jab
  • 26,853
  • 21
  • 75
  • 114
Robert Criqui
  • 208
  • 3
  • 11

1 Answers1

0

Use style_theme_use("clam")

Here is the code

style = ttk.Style(root)
style.theme_use("clam")
style.configure("Treeview.Heading", background="black", foreground="white")
Ujjwal Dash
  • 767
  • 1
  • 4
  • 8
  • Thank you. This is a start, but if I do that I'm going to be changing the theme for all of my widgets. Seems like an odd feature. – Robert Criqui Aug 04 '20 at 02:47
  • 4
    @RobertCriqui The explanation is that not all ttk themes allow you to change headings (and buttons) background color because those elements are made from pictures. So if you want to change these colors, you need to use one of themes that allows it, llke "clam", but not Windows or OSX default themes . – j_4321 Aug 05 '20 at 11:02