

def add_node(self, node, parent=None):
    'Add a new node to the tree.\n\n        :Parameters:\n            `node`: instance of a :class:`TreeViewNode`\n                Node to add into the tree\n            `parent`: instance of a :class:`TreeViewNode`, defaults to None\n                Parent node to attach the new node. If `None`, it is added to\n                the :attr:`root` node.\n\n        :returns:\n            the node `node`.\n        '
    if (not isinstance(node, TreeViewNode)):
        raise TreeViewException('The node must be a subclass of TreeViewNode')
    if ((node is None) and self._root):
        parent = self._root
    if parent:
        parent.is_leaf = False
        parent.nodes.append(node)
        node.parent_node = parent
        node.level = (parent.level + 1)
    node.fbind('size', self._trigger_layout)
    self._trigger_layout()
    return node

dataset/ETHPy150Open kivy/kivy/kivy/uix/treeview.py TreeView.add_node/VarMisuse@41/212 `parent`->`node`