Search code examples
pythonwxpythonwxwidgets

Duplicating/Copying Item on TreeCtrl


How can I duplicate a element on a TreeCtrl exactly then put it right after the original element? I cant find a function on the API that does this.


Solution

  • Did you try InsertItem or InsertItemBefore?. When you select a tree item, just pull out whatever data you want to copy in your event handler, create the new item with a unique ID and use one of those insert methods.

    Or you could try the CustomTreeCtrl or the HyperTreeList. The custom one has a DoInsertItem method and a couple other insert methods that are different than the tree control.