我试图从我创建并解析的标签中获取一个字符串值,或者将它转换成一个整数,这样我就可以在标签的值上加上+1,然后再将其设置回标签中。例:如果标签上写着“4”,按一个按钮来增加它就会显示“5”。谢谢!在
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'
明确声明传递的参数是
unexpected type
。所以接下来您应该考虑的是,什么类型对QString
重要来自http://pyqt.sourceforge.net/Docs/PyQt4/qstring.html
所以
相关问题 更多 >
编程相关推荐