源码之家:www.mycodes.net

python

py-QT


 http://blog.csdn.net/seeground/article/details/49177387   GO

 


  

字符串转换

qStr = QString('abc')
Str = str(qStr)

myText = unicode(self.myLineEdit.text().toUtf8(),'utf8', 'ignore')

 

Str = u'一个'
qStr = QString(Str)

 

qStr = QString(u'一个')
Str = unicode(qStr.toUtf8(),'utf-8','ignore')


lineedit 控件

self.textHello.setText("Hello PyQt!\nThe button has been pressed.")

self.myLineEdit.text()

 


 编码设置

def main():
    reload(sys)                         # 2
    sys.setdefaultencoding('utf-8')     # 3

 


 

 

 

 

 

 

 

 

 

 

联系我们Contact

Copyright © 2013 - 2024 mycodes.net All rights reserved.

公司位置