K-Doe
K-Doe

Reputation: 559

Python tkinter treeview get full path

How do i get the full path of a selected node in a treeview?

I use:

    curItem = tree.focus()
    item_list = tree.item(curItem)

But this only gives me the node i selected not the name of the "master" node.

I use the Treeview do Display the data in a Folder.

I want "Folder_1\File.txt" as a result."

Upvotes: 0

Views: 1283

Answers (1)

K-Doe
K-Doe

Reputation: 559

Found it:

item_iid = tree.selection()[0]
parent_iid = tree.parent(item_iid)
node = tree.item(parent_iid)['text']

Upvotes: 2

Related Questions