Tkinter Change Style Questions
Right now I have this code: tree = ttk.Treeview(root) style = ttk.Style() style.configure('Treeview', foreground='#00337f',background='#ffc61e') style.configure('Treeview.Heading',
Solution 1:
The first problem can be solved by adding fieldbackground="#ffc61e"
in the configuration of the Treeview
style. The background option corresponds to the background of the items only. However, not all themes takes the fieldbackground
option into account (see the second problem).
The second problem is theme related. The theme you are using does not support color change for the headings, so I suggest you to use another one like 'clam' or 'alt': style.theme_use('clam')
.
To remove the borders of the buttons in the heading, you can set the border width to 0:
style.configure("Treeview.Heading", borderwidth=0)
.
Unfortunately, this does not work for the Treeview border, so the solution is to set all colors of the border to the background color:
style.configure("Treeview", lightcolor="#ffc61e", bordercolor="#ffc61e",
darkcolor="#ffc61e")
Post a Comment for "Tkinter Change Style Questions"