def clear(self):
        """Removes all child widgets."""
        layout = self.layout()
        for index in reversed(range(layout.count())):
            item = layout.takeAt(index)
            try:
                item.widget().deleteLater()
            except AttributeError:
                item = None
Removes all child widgets.