How can I generate python code from a QtDesigner file ? I found pyside-uic but I can\'t find an example for the syntax. I run win7 and pythonxy with spyder.
Read the documentation. In this particular case, http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#pyuic4:
The pyuic4 utility is a command line interface to the uic module. The command has the following syntax:
pyuic4 [options] .ui-file
The full set of command line options is:
-h, --help A help message is written to stdout.
--version The version number is written to stdout.
-i N, --indent=N
The Python code is generated using an indentation of N spaces. If N is 0 then a tab is used. The default is 4.
-o FILE, --output=FILE
The Python code generated is written to the file FILE.
-p, --preview The GUI is created dynamically and displayed. No Python code is generated.
-w, --pyqt3-wrapper
The generated Python code includes a small wrapper that allows the GUI to be used in the same way as it is used in PyQt v3.
-x, --execute The generated Python code includes a small amount of additional code that creates and displays the GUI when it is executes as a standalone application.
--from-imports Resource modules are imported using from . import rather than a simple import.
Look at C:\Python27\Lib\site-packages\PySide\scripts\uic.py (or wherever you have python installed). If you look at that script you can see the options labelled and described as in the man page (Which I don't know how to view properly on windows. Tips appreciated.) here http://manpages.ubuntu.com/manpages/precise/man1/pyside-uic.1.html
I got confused for a while trying to look at C:\Python27\Lib\site-packages\pysideuic\pyside-uic.1 as I thought that must be the file that is being called. Even trying to view that as a manual page is impossible for me because of all the extra characters. You can't learn syntax by trying to guess at which characters are extra and which ones aren't!
On windows you can automate this with a batch file of course by saving a text file with the above mentioned line(below for reference) with .bat extension like uic_generator.bat.
pyside-uic MyWindow.ui -o MyWindow.py