Hi! :)

As said in the title i try to get (as a string) the parent of a selected item, but i can't manage to do it.

Of course i can easily retrieve the string of the selected item with GetItemText... But how do we retrieve its parent?

Example: if the selected item is a child of parent1, how can i know that its parent is parent1?

Thanks for your help!!

item.GetParent() will do ok?

Hi richieking,

thanks for your answer!

I finally find how to do it:

item =  self.tree.GetSelection()
parent = self.tree.GetItemParent(item)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.