def test_deleteNode(): from mglutil.gui.BasicWidgets.Tk.TreeWidget.tree import TreeView tv = TreeView() #Add some nodes tv.addNode('protein_1') tv.addNode('residue_11', parent='protein_1') tv.addNode('AminoAcid', parent='protein_1|residue_11') tv.addNode('A', parent='protein_1|residue_11|AminoAcid') node = tv.addNode('H', parent='protein_1|residue_11|AminoAcid') tv.addNode('protein_2') # Now deleteing tv.deleteNode_byName('A', parent='protein_1|residue_11|AminoAcid') tv.deleteNode_byName('protein_2') tv.deleteNode(node) # the following returns error message, # since AminoAcid is NOT the child of 'protein_1' tv.deleteNode_byName('AminoAcid', parent='protein_1') # This should work tv.deleteNode_byName('AminoAcid', parent='protein_1|residue_11') tv.destroy()