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?
Like designer.exe, pyside-uic.exe, pyside2-uic.exe can also be found in the installation directory of python or Maya. Tips: cmd path cd is the development path (. ui,. py file path), drag pyside-uic.exe to the cmd window.
PySide is a Python binding of the cross-platform GUI toolkit Qt developed by The Qt Company, as part of the Qt for Python project. It is one of the alternatives to the standard library package Tkinter. Like Qt, PySide is free software. PySide supports Linux/X11, macOS, and Microsoft Windows. PySide.
PySide2 is the official Python module from the Qt for Python project, which provides access to the complete Qt 5.12+ framework. The Qt for Python project is developed in the open, with all facilities you'd expect from any modern OSS project such as all code in a git repository and an open design process.
If you installed PySide with homebrew, you need to install pyside-tools
package also to get these command line tools:
$ brew install pyside-tools
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.
When I installed using conda, the py-uic.exe was not unpacked. The problem was fixed by uninstalling and using pip.
>pip install pyside
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With