Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python 3 tkinter treeview example

# How to create a basic Treeview
tv = Treeview(self)  		# could also include columns with
tv['columns'] = 'Column2'	# Treeview(master, column=('yourcolumnname'))
tv.heading('#0', text='Heading1')  # '#0' standard name for the first column
tv.heading('Column2', text='I am the SECOND column')
parentrow = tv.insert('', 0, text="ParentRow", values=1)
tv.insert(parentrow, 1, text="Level2", values=2)  # subrow
tv.pack()

# if you put a tuple for values, then they will be iterated for each of your columns
# example in this Treeview tv:
tv['columns'] = ('C2', 'C3')
tv.insert('', 2, text='proove', values=('for', 'you'))

# sidenote: in the example I found they used 'end' as index for the subrow
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #tkinter #treeview
ADD COMMENT
Topic
Name
6+9 =