How to fully change the background color on a tkinter.ttk Treeview
To make the background of a Treeview totally black, both the background
and the fieldbackground
options of the Treeview style need to be set to black.
In addition, not all ttk themes support the fieldbackground
option, like the "xpnative" and "vista" themes.
Code:
import tkinter as tkfrom tkinter import ttkroot = tk.Tk()style = ttk.Style(root)# set ttk theme to "clam" which support the fieldbackground optionstyle.theme_use("clam")style.configure("Treeview", background="black", fieldbackground="black", foreground="white")tree = ttk.Treeview(root)tree.insert("", 0, "item", text="item")tree.pack()root.mainloop()