I recently started studying Python and now I'm making a software with a GUI using PyQt Libraries.
Here's my problem:
I create a Scrollarea, I put in this scrollarea a widget which contains a QGridLayout.
sa = QtGui.QScrollArea()
sa_widget = QtGui.QWidget()
i = 0
i = i +1
add = QtGui.QLabel("Row %i" % i)
tmp = QtGui.QWidget()
tmp = self.sa_grid.itemAt(0)
Removing an item from a layout does not delete it. The item will just become a free-floating object with no associated layout.
If you want to get rid of the object completely, explicitly delete it:
def deleteGridWidget(self, index): item = self.sa_grid.itemAt(index) if item is not None: widget = item.widget() if widget is not None: self.sa_grid.removeWidget(widget) widget.deleteLater()