2

I'm trying to use ttk.Treeview() for sortable tables. It would be helpful if I could show grid lines. I tried to use Style() for this but found nothing. Does anyone have an idea how to do that?

from Tkinter import *
import ttk

header = ['col1', 'col2']
data = [('a', '4') ,('b', '1') ,('c', '2') ,('d', '3') ,('e', '5')]

root = Tk()

f1 = ttk.Frame(root)
f1.pack()
t1 = ttk.Treeview(f1, columns=header, show="headings")
t1.pack()

for col in header:
   t1.heading(col, text=col.title())
for item in data:
   t1.insert('', 'end', values=item, tags=('items',))

root.mainloop()
MartinM
  • 65
  • 1
  • 9
  • 1
    Your question is unclear as it is. Please share your code and elaborate more – Billal Begueradj Apr 23 '16 at 17:06
  • I think the OP means add seperators between each item, in which case I can't find any information about that but you may consider [alternating the background](http://stackoverflow.com/questions/7878730/ttk-treeview-alternate-row-colors) to indicate the seperation. – Tadhg McDonald-Jensen Apr 23 '16 at 17:10
  • yes, you're right, I'd like to add separators between the lines. Found a solution re alternating background, but I'd like to solve this in a less complex way. There's going to be large sets of data... – MartinM Apr 23 '16 at 17:19
  • ... which later I'd like to sort, filter, mark, copy (and paste somewhere else) – MartinM Apr 23 '16 at 17:36
  • @MartinM did you find a solution to this problem? – ragardner Jun 13 '17 at 14:42
  • no, didn't find a solution – MartinM Nov 02 '19 at 18:45
  • Does this answer your question? [Creating a grid lines inside of tkinter treeview](https://stackoverflow.com/questions/50557281/creating-a-grid-lines-inside-of-tkinter-treeview) – WinEunuuchs2Unix Mar 19 '21 at 23:16

0 Answers0