PDA

View Full Version : PyQt Populate a QTableWidget



n3wcr4zy
2nd March 2011, 09:20
How i populate QTableWidget from SQLite Query?



def proximo_alarm(self):
self.cur.execute('SELECT * FROM alunos')
a = 0
for row in self.cur:
b = 0
for item in self.cur[row]:
nw = QtGui.QWidgetItem(item)
self.tMain.setItem(b, a, nw)
b += 1
a += 1


i get this error:


for item in self.cur[row]:
TypeError: 'sqlite3.Cursor' object is unsubscriptable