0

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

1
  • style.layout("Treeview", [('Treeview.treearea', {'sticky': 'nswe'})]) # Remove the borders Commented Jan 18 at 12:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.