Reputation: 1646
Suppose I have a pyqt4 table widget, for example:
self.table = QtGui.QTableWidget(3,4)
With self.table.clear()
I can remove all contents of the table. However how can I delete all cells of the table, not only the content?
Upvotes: 6
Views: 9992
Reputation: 36715
Alternatively, you can set the row and column counts:
self.table.setRowCount(0)
self.table.setColumnCount(0)
Upvotes: 14
Reputation: 12743
Haven't tried it, but you can try:
for i in reversed(range(self.table.rowCount())):
self.table.removeRow(i)
Upvotes: 4