QHBoxLayout清空子控件
layout = QHBoxLayout() widget1 = QLabel("Widget 1") widget2 = QLabel("Widget 2") widget3 = QLabel("Widget 3") layout.addWidget(widget1) layout.addWidget(widget2) layout.addWidget(widget3) # remove widget2 from the layout layout.removeWidget(widget2) widget2.deleteLater()
#####################
标签:控件,Widget,QHBoxLayout,layout,addWidget,widget2,空子 From: https://www.cnblogs.com/herd/p/17252682.html