Reputation: 1603
I am writting an application with PyQt. I have a list like:
rList = [['no','status'], ['anotherno','anotherstatus']]
and I have a QTAbleWidget with 2 columns. How can I set the QTableWidget's data from this list with easiest way?
Upvotes: 0
Views: 2392
Reputation: 3661
j=0
for i in rList:
self.ui.myTableWidget.setItem(j, 0, QtGui.QTableWidgetItem(i[0]))
self.ui.myTableWidget.setItem(j, 1, QtGui.QTableWidgetItem(i[1]))
j=j+1
Upvotes: 1