2012-02-24 5 views
2

form_shiftpysideのQTableWidgetから表のセルの値を取得するには?

tblSessionフォーム名ですQTableWidgetオブジェクト

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

エラーです:これは私のためだけで正常に動作

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

私たちがお手伝いできるように、さらにコードを記入してください。 –

答えて

3

。おそらくあなたのテーブルにはその座標にアイテムがありませんか?

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()) 
関連する問題