0
我試圖畫靜態文本,但得到錯誤,你能解釋我做錯了什麼,爲什麼NoneType?drawStaticText給出了錯誤
這裏是代碼:
sT = QtGui.QStaticText()
text = 'text'
painter.drawStaticText(QtCore.QPoint(40, 50), sT.setText(text))
和錯誤:
painter.drawStaticText(QtCore.QPoint(40, 50), staticT.setText(text))
TypeError: arguments did not match any overloaded call:
QPainter.drawStaticText(QPointF, QStaticText): argument 2 has unexpected type 'NoneType'
QPainter.drawStaticText(QPoint, QStaticText): argument 2 has unexpected type 'NoneType'
QPainter.drawStaticText(int, int, QStaticText): argument 1 has unexpected type 'QPoint'
謝謝。
我認爲你必須在兩個步驟 - 第一個'sT.setText(文本)'和以後'drawStaticText(QtCore.QPoint(40,50),sT)' – furas