We kept one button to show the selected node value and another button to Update the name of the selected node. Here only the Name column data we will select and update. Print(trv.item(p_id)) # List of valuesī1=tk.Button(my_w,text='Show',command=show)ī1.grid(row=2,column=1) Edit and update selected item value Print(trv.item(p_id)) # Dictionary of all options Trv.bind(">", data_collect()) Displaying selected item value def show(): P_id = trv.selection() # collect selected row id Print(my_list) On select event of treeview def data_collect(): Treeview Parent-child nodes Getting list of data from Treeview my_list= We can set the parent and child rows or nodes to the Treeview. '' : Neither tree view nor headings are shown. Tree headings : (Default) Show both heading and expanding child node. Tree: Show tree view with expanding the child node. Show option: trv = 'tree' headings: Show the headings without the column marked as #0 The line saying trv = 'tree' can take the value as headings trv = 'headings' and the column with #0 will be hidden.
Watch the column with #0, this column will display in Tree and show the text part given in each row. # Defining headings, other option is tree
Trv = ttk.Treeview(my_w, selectmode ='browse') Tkitner Treeview to get Parent Child nodes and display data in hierarchical order