10

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?

Dexter
  • 6,170
  • 18
  • 74
  • 101

6 Answers6

9

If you installed PySide with homebrew, you need to install pyside-tools package also to get these command line tools:

$ brew install pyside-tools
kissgyorgy
  • 2,947
  • 2
  • 32
  • 54
8

You should see a /Python27/Scripts/pyside-uic.exe. But I'm wondering why it's not visible (not executable). Maybe it's a packaging problem (permissions, etc). You could try to call it using the complete path.

Luck
  • 141
  • 1
3

When I installed using conda, the py-uic.exe was not unpacked. The problem was fixed by uninstalling and using pip.

>pip install pyside
Mitch
  • 71
  • 3
2

For Mac it worked for me running the following command (needed to have macports installed):

sudo port install py27-pyside-tools

It installs on my Python 2.7 environment. I hope it helps.

Joepreludian
  • 980
  • 9
  • 11
2

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.
ewerybody
  • 1,443
  • 16
  • 29
0

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
Zoe
  • 27,060
  • 21
  • 118
  • 148