PDA

View Full Version : How to use pyuic?



Amelie
7th March 2011, 13:32
Hello,

I wrote a GUI in Qt Creator (2.1) and would like to now make it usable with a python (2.5) plugin in QGIS (1.6).
I'm trying to run...keep getting the error message: "NameError: name 'pyuic' is not defined"

pyuic4 -o mainwindow.py mainwindow.ui

"ImportError: No module named pyuic",

I also tried importing the module first though the module does exist in 'C:\Programs\Quantum GIS Copiapo\apps\Python25\Lib\site-packages\PyQt4\uic'. I ran it in different prompts: QGIS Python console, Python IDLE Shell, and the windows command prompt.

As suggested in another forum, I tried generating the code dynamically using from PyQt4 import uic (mainwindow.ui lies in the same folder as the file that the command is embedded in)

form_class, base_class = uic.loadUi("mainwindow.ui", self)

Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\__init__.py", line 92, in loadUiType
winfo = compiler.UICompiler().compileUi(uifile, code_string)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\Compiler\compiler.py", line 66, in compileUi
w = self.parse(input_stream)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 759, in parse
document = parse(filename)
File "<string>", line 45, in parse
File "<string>", line 22, in parse
IOError: [Errno 2] No such file or directory: 'mainwindow.ui'

I couldn't find anyone else with a similar problem. In all the tutorials it seems like such a simple step... I'd very much appreciate any help.

Amelie