'Replace the child canvas widget ``oldchild`` with ``newchild``.
``newchild`` must not have a parent.  ``oldchild``\'s parent will
be set to None.
:type oldchild: CanvasWidget
:param oldchild: The child canvas widget to remove.
:type newchild: CanvasWidget
:param newchild: The canvas widget that should replace
``oldchild``.'

def replace_child(self, oldchild, newchild):

    index = self._children.index(oldchild)
    self._children[index] = newchild
    self._remove_child_widget(oldchild)
    self._add_child_widget(newchild)
    self.update(newchild)
