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

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

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.