QHBoxLayout清空子控件

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()

 

#####################

posted @ 2023-04-05 22:50  西北逍遥  阅读(442)  评论(0编辑  收藏  举报