树视图的活动背景颜色 header

Active background color to treeview header

如何设置树视图标题的活动背景色。使用以下代码,背景和前景工作正常但活动背景不起作用。请帮我解决这个问题

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

您需要使用 style.map 来更改行为:

pressed_color = 'black'
highlight_color='red'

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

作为