Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从pyside中的QTableWidget获取表单元格值?_Python - Fatal编程技术网

Python 如何从pyside中的QTableWidget获取表单元格值?

Python 如何从pyside中的QTableWidget获取表单元格值?,python,Python,表单\u shift是表单名称 tblSession是QTableWidget对象 shift_id=form_shift.tblSession.item(1,0).text() 错误: AttributeError: 'NoneType' object has no attribute 'text' 这对我来说很好。也许您的表在这些坐标处没有项目 table = QtGui.QTableWidget(5, 3, self) for row in range(5): for col i

表单\u shift
是表单名称

tblSession
QTableWidget
对象

shift_id=form_shift.tblSession.item(1,0).text()
错误:

AttributeError: 'NoneType' object has no attribute 'text'

这对我来说很好。也许您的表在这些坐标处没有项目

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())

请发布更多代码,以便我们可以帮助您。