code: def clear(self):
          
          for i in range(self.count() - 1, -1, -1):
              w = self.widget(i)
              if w:
                  self.removeWidget(w)
                  w.close()
                  w.deleteLater()
docs: Clears out the widgets from this stack.