python 3 tkinter treeview example

Solutions on MaxInterview for python 3 tkinter treeview example by the best coders in the world

showing results for - "python 3 tkinter treeview example"
Delfina
30 Nov 2019
1# How to create a basic Treeview
2tv = Treeview(self)  		# could also include columns with
3tv['columns'] = 'Column2'	# Treeview(master, column=('yourcolumnname'))
4tv.heading('#0', text='Heading1')  # '#0' standard name for the first column
5tv.heading('Column2', text='I am the SECOND column')
6parentrow = tv.insert('', 0, text="ParentRow", values=1)
7tv.insert(parentrow, 1, text="Level2", values=2)  # subrow
8tv.pack()
9
10# if you put a tuple for values, then they will be iterated for each of your columns
11# example in this Treeview tv:
12tv['columns'] = ('C2', 'C3')
13tv.insert('', 2, text='proove', values=('for', 'you'))
14
15# sidenote: in the example I found they used 'end' as index for the subrow