Where is pyside-uic?

Viewed 27243

I'm trying to use Qt Designer and pyside-uic mydesign.ui > design.py

however, this program doesn't exist. I looked in site packages under python 2.7, and I see: pyside-lupdate.exe pyside-rcc.exe

and a bunch of other programs, but there is no such thing as pyside-uic.exe ... why ?? Why is it missing from the installation package? Where do I get it?

6 Answers

Since a couple years passed by and some things were fixed: I guess the official answer would now be:

Use uic.exe! But how?

So although the official docs still lack any info about it you can now compile .ui files to Python directly with this executable shipped with the PySide2 package you get via pip install PySide2. This is how you would write it:

uic.exe -g python your_design.ui -o your_design_ui.py

Where your_design.ui is the Qt Designer file and your_design_ui.py the target Python file to generate. VoilĂ !

Btw: here is the help from uic -?

C:\Python38\Lib\site-packages\PySide2>uic.exe -h
Usage: uic.exe [options] [uifile]
Qt User Interface Compiler version 5.15.0

Options:
-?, -h, --help                Displays help on commandline options.
--help-all                    Displays help including Qt specific options.
-v, --version                 Displays version information.
-d, --dependencies            Display the dependencies.
-o, --output <file>           Place the output into <file>
-a, --no-autoconnection       Do not generate a call to
                                QObject::connectSlotsByName().
-p, --no-protection           Disable header protection.
-n, --no-implicit-includes    Disable generation of #include-directives.
-s, --no-stringliteral        Deprecated. The use of this option won't take
                                any effect.
--postfix <postfix>           Postfix to add to all generated classnames.
--tr, --translate <function>  Use <function> for i18n.
--include <include-file>      Add #include <include-file> to <file>.
-g, --generator <python|cpp>  Select generator.
--idbased                     Use id based function for i18n
--from-imports                Python: generate imports relative to '.'

Arguments:
[uifile]                      Input file (*.ui), otherwise stdin.

In case someone need it, for Ubuntu 18.04 I need to install pyside-tools package first. Hope that helps.

sudo apt-get install pyside-tools
Related