0

How to set the active background color for the treeview heading. used the following code, background and foreground is working fine but active background is not working. please help me with this

ttk.Style().theme_use('default')
ttk.Style().configure("Treeview.Heading",font=("Calibri",12,'italic'),activebackground="#81C44C",background = "#0D94D2",foreground="White")
Kyle
  • 63
  • 7

1 Answers1

1

You need to use style.map to change the behavior:

pressed_color = 'black'
highlight_color='red'

ttk.Style().map("Treeview.Heading",
                background = [('pressed', '!focus', pressed_color),
                              ('active', highlight_color),
                              ('disabled', '#ffffff')])

As a good source

Thingamabobs
  • 7,274
  • 5
  • 21
  • 54