Hi
I’m not having much luck removing rows from a table in Qt
class TableView(QtGui.QTableWidget):
def __init__(self, parent=None):
super(TableView, self).__init__(parent)
self.setColumnCount(3)
self.setHorizontalHeaderLabels(['student', 'submitted', 'file'])
self.style()
def addItem(self, row, column, args):
item = QtGui.QTableWidgetItem(args)
self.setItem(row, column, item)
def remove_item(self):
for i in reversed(range(self.rowCount())):
self.removeRow(i)
tv = self.table_widget
tv.remove_item()
for row, key in enumerate(stud):
tv.insertRow(row)
tv.addItem(row, 0, key)
tv.addItem(row, 1, stud[key][0])
tv.addItem(row, 2, stud[key][1])
I’ve tried removing the rows in reverse but it won’t remove them all… I seem to be able to overwrite rows thou… anyhow… not sure where to go from here…
cheers!