How do I get a tree item's data by index of the tree?
I'm currently writing a GUI with wxPython (using Python 2.7). This GUI contains a CustomTreeCtrl that is build as follows:
# Create Tree control
widget_tree = CustomTreeCtrl(parent=self, id=ID_WIDGET_TREE, agwStyle=wx.TR_HIDE_ROOT | wx.TR_SINGLE | wx.TR_HAS_BUTTONS,
size=(UI_tree_width, -1))
widget_tree.SetBackgroundColour(wx.WHITE)
root = widget_tree.AddRoot(text="root")
# Create general
item_general = widget_tree.AppendItem(parentId=root, text='General')
item_main = widget_tree.AppendItem(parentId=item_general, text='Main', data={'tooltip': 'Main'})
widget_tree.AppendItem(parentId=item_general, text='Manual', data={'tooltip': 'Manual'})
widget_tree.AppendItem(parentId=item_general, text='Boundary conditions', data={'tooltip': 'BC'})
# Create stiffeners
item_stiffener = widget_tree.AppendItem(parentId=root, text='Stiffeners')
widget_tree.AppendItem(parentId=item_stiffener, text='Stiffener 1', data={'tooltip': 'Stiffener 1'})
widget_tree.AppendItem(parentId=item_stiffener, text='Stiffener 2', data={'tooltip': 'Stiffener 2'})
widget_tree.AppendItem(parentId=item_stiffener, text='Add stiffener', data={'tooltip': 'Creates a new stiffener'})
The data will be extended with certain input by the user. Besides that clicking on 'Add stiffener' will insert an item above 'Add stiffener'. For the purpose of the tool I need to get this data from every stiffener. I was wondering if it is possible to call these like lists in lists. So for example I could call widget_tree.GetTreeItem[0][1][0] for [root][stiffeners][stiffener 1] and so on.
I've been looking for a while now and was hoping someone could help me out. Thanks in advance!