code: def clear_layout(layout: QLayout) -> None:
      
      if layout is not None:
          while layout.count():
              item = layout.takeAt(0)
              widget = item.widget()
              if widget is not None:
                  widget.deleteLater()
              else:
                  clear_layout(item.layout())
docs: Clear the layout off all its components