0

I managed to style a treeview control to this nice gridview:

enter image description here

container = tk.Frame(self, relief='sunken', borderwidth=1, bg='white')
container.grid(column=0, row=0, sticky='nsew')
container.grid_columnconfigure(0, weight=1)
container.grid_rowconfigure(0, weight=1)

style = ttk.Style()
style.layout('NoBorder.Treeview', [('Flat.Treeview', {'border': 1})])
self.tree = ttk.Treeview(container, columns=self.header, show='headings', style='NoBorder.Treeview', height=0)
vsb = ttk.Scrollbar(container, orient="vertical", command=self.tree.yview)
hsb = ttk.Scrollbar(container, orient="horizontal", command=self.tree.xview)
corner = Frame(container, bg='SystemButtonFace')
self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
self.tree.grid(column=0, row=0, sticky='nsew')
vsb.grid(column=1, row=0, sticky='ns')
hsb.grid(column=0, row=1, sticky='ew')
corner.grid(column=1, row=1, sticky='nsew')

This way, the border around it is done by the container.

Can I somehow change this style to draw inner lines? After each row, and each column.

1
  • 1
    I'm not sure if this is possible - or maybe it depens on system (Windows/Mac/Linux) or version of Tcl/Tk. But maybe you could use differrent widget which uses Canvas with Label to simulate table - like PandasTable (in link you can see image) or the same author tkintertable (here screenshots). I also found tksheet. Commented Oct 20 at 19:51

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.