pyqt4 python2.7 中文乱码的解决方法
import sys
import locale
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from untitled import Ui_Dialog
if __name__=="__main__":
app = QApplication(sys.argv)
mycode = locale.getpreferredencoding()
code = QTextCodec.codecForName(mycode)
QTextCodec.setCodecForLocale(code)
QTextCodec.setCodecForTr(code)
QTextCodec.setCodecForCStrings(code)
myframe = MyForm()
myframe.show()
sys.exit(app.exec_())
--参考: http://www.xuebuyuan.com/2055151.html