Python: Treeviews

Does anyone know how to use a selected record’s place in a treeview to determine the cell in which the program should return the value back into Excel?

I tried to get the selected record using tree.focus() but got nowhere.

Get id of treeview item you want to highlight/select

child_id = tree.get_children()[-1]

To highlight the item, use both focus() and selection_set(item_id)

tree.focus(child_id)
tree.selection_set(child_id)

Leave a Comment