XlayerCrz
XlayerCrz

Reputation: 1

Python Borderless ttk.Treeview

I have a treeview that I don't want to have borders, I managed to do it with borderwidth=0, however when selecting an element the border reappears, I tried to put borderwidth=0 when selecting or focusing the object but it didn't work instead it continued to show a border, I attached images and the code.

tree = ttk.Treeview(
    scrollable_frame,
    show="tree",
)
tree.pack(fill="both", expand=True, padx=0, pady=0)

style = ttk.Style()
style.theme_use("default")
style.configure(
    "Treeview",
    background="#264CBF",
    fieldbackground="#264CBF",
    foreground="white",
    rowheight=25,
    bordercolor="#264CBF",
    highlightthickness=0,   
    relief="flat",         
    borderwidth=0,
)
style.map(
    "Treeview", 
    background=[("focus", "#213B90")],  
    foreground=[("focus", "white")],   
    highlightcolor=[("focus", "#264CBF")],  
    bordercolor=[("focus","#264CBF")],
    relief=[("focus","flat")],
    highlightthickness=[("focus",0)],
    borderwidth=[("focus",0)]
)

Selected object Unselected object

Upvotes: 0

Views: 43

Answers (0)

Related Questions