I'm trying to get a string value from a label that I created and parsing, or casting it into an integer so I can add + 1 to that value of the label and then setting it back into the label. ex: having a label that says "4" press a button to increase it will then say "5". Thanks!
self.lblCam1Focus = QtGui.QLabel("4",self)
self.lblCam1Focus.move(50,60)
def cam1IncreaseFocus(self):
text = self.lblCam1Focus.text
n = text
n = n + 1
self.lblCam1Focus.setText(n)
TypeError: QLabel.setText(QString): argument 1 has unexpected type 'int'
Clearly states that the argument passed is
unexpected type
. So next thing you should consider is, what type is important forQString
From http://pyqt.sourceforge.net/Docs/PyQt4/qstring.html
So,