form_shift
是表格名称
tblSession
是QTableWidget
对象
shift_id=form_shift.tblSession.item(1,0).text()
Run Code Online (Sandbox Code Playgroud)
错误:
AttributeError: 'NoneType' object has no attribute 'text'
Run Code Online (Sandbox Code Playgroud)
这对我来说很好用。也许您的桌子在这些坐标处没有项目?
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())
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18370 次 |
最近记录: |