This is the code that should use a simple form with a button and a label.
#-*- coding: utf-8 -*- from PyQt4 import uic, QtCore, QtGui, uic import sys app = QtGui.QApplication(sys.argv) window = uic.loadUi("MyForm.ui") QtCore.QObject.connect(window.btnQuit, QtCore.SIGNAL("clicked()"), QtGui.qApp.quit) window.show() sys.exit(app.exec_())
I get an error:
Traceback (most recent call last): File "G:\Python32\освоение pyqt\start2.py", line 5, in <module> window = uic.loadUi("MyForm.ui") File "G:\Python32\lib\site-packages\PyQt4\uic\__init__.py", line 219, in loadUi from PyQt4.uic.Loader.loader import DynamicUILoader UnicodeEncodeError: 'latin-1' codec can't encode characters in position 12-19: ordinal not in range(256)
I don’t know what the problem is ... The form itself (.ui file) is saved in utf-8, the script itself also works in utf-8 ... Where to fix / convert where - I won’t put my mind to it.