你可以试试
def removeWidget(self): widget = self.widgets.pop() widget.widgetFrame.pack_forget() print(self.widgets)