[ACCEPTED]-How to dynamically change child widgets with Python and Qt?-pyside
Accepted answer
removeWidget()
only removes the item from the layout, it 2 doesn't delete it. You can delete the child 1 widget by calling setParent(None)
.
def update(self):
self.layout().removeWidget(self.child)
self.child.setParent(None)
self.child = QLabel("bar", self)
self.layout().addWidget(self.child)
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.