@
Larz60+
#1, The Codes:
from tkinter import *
from tkinter import ttk
# create the app
root = Tk()
root.title("Treeview Test")
# Create pane window
panew = PanedWindow(root, bd=0, bg="#202322", sashwidth=2)
panew.pack(fill=BOTH, expand=1)
left_frame = Frame(root, bg="#383838")
tree = ttk.Treeview(left_frame)
tree["columns"] = ("first", "second")
tree.column("first", anchor="center")
tree.column("second")
tree.heading("first", text="first column")
tree.heading("second", text="second column")
tree.insert("", 0, "dir1", text="directory 1", open=True)
tree.insert("dir1", "end", "dir 1", text="file 1 1",values=("file 1 A", "file 1 B"))
id = tree.insert("", "end", "dir2", text="directory 2", open=True)
# set the tag for this item
tree.insert("dir2", "end", text="dir 2", values=("file 2 A", "file 2 B"), tags=('ttk'))
tree.insert(id, "end", text="dir 3", values=("val 1 ", "val 2"))
tree.insert("", 0, text="first line", values=("first line 1", "first line 2"))
# tag configuration
tree.tag_configure("ttk", background='yellow',foreground="red")
# Create scroller bar
ysb = ttk.Scrollbar(left_frame, orient=VERTICAL, command=tree.yview)
xsb = ttk.Scrollbar(left_frame, orient=HORIZONTAL, command=tree.xview)
tree['yscroll'] = ysb.set
tree['xscroll'] = xsb.set
root.configure(background='black')
tree.grid(in_=left_frame, row=0, column=0, sticky=NSEW)
ysb.grid(in_=left_frame, row=0, column=1, sticky=NS)
xsb.grid(in_=left_frame, row=1, column=0, sticky=EW)
left_frame.rowconfigure(0, weight=1)
left_frame.columnconfigure(0, weight=1)
panew.add(left_frame)
w = Text(panew)
panew.add(w)
ttk.Style().theme_use('clam')
print(ttk.Style().theme_names())
root.mainloop()
#2, result by "Python 3.6.12 :: Anaconda, Inc."
I don't know how to upload the screenshot.
But the result is the item with tag 'ttk' show what i expected
#2, result by "Python 3.8.3 (anaconda)"
The item with tag 'ttk' have no difference compare to other items.