Python code generation with pyside-uic

ArtDijk picture ArtDijk · Dec 14, 2010 · Viewed 48.4k times · Source

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.

Answer

FrederikNS picture FrederikNS · May 4, 2011

pyside-uic is more or less identical to pyuic4, as such the man page specifies:

Usage:
        pyside-uic [options] <ui-file>

Options:
    --version
        show program's version number and exit

    -h,--help
        show this help message and exit

    -oFILE,--output=FILE
        write generated code to FILE instead of stdout

    -x,--execute
        generate extra code to test and display the class

    -d,--debug
        show debug output

    -iN,--ident=N
        set indent width to N spaces, tab if N is 0 (default: 4)

I usually use it like this:

pyside-uic -o output.py input.ui