Reputation: 181
form_shift
is form name
tblSession
is QTableWidget
object
shift_id=form_shift.tblSession.item(1,0).text()
Error:
AttributeError: 'NoneType' object has no attribute 'text'
Upvotes: 3
Views: 28764
Reputation: 1773
This works just fine for me. Perhaps your table does not have an item at those coordinates?
table = QtGui.QTableWidget(5, 3, self)
for row in range(5):
for col in range(3):
table.setItem(row, col, QtGui.QTableWidgetItem("(%d, %d)" % (row, col)))
print("1,0: %s" % table.item(1, 0).text())
Upvotes: 7