İlker Dağlı
İlker Dağlı

Reputation: 1603

How to set QTableWidget's data

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

Answers (1)

Aleksandar
Aleksandar

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

Related Questions