Python Forum
Are there programs that convert .ui files to .py for you?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Are there programs that convert .ui files to .py for you?
#1
I'm trying to convert .ui files to .py files but I'm experiencing tremendous frustration in doing it manually. I've searched Google and I'm not having any luck finding such a program. I want to just upload my .ui files onto a program that turns them into .py files for me. Does such a thing exist?
Reply
#2
pyuic4 input.ui -o output.py

or

pyuic5 input.ui -o output.py

Quote:Options:
--version show program's version number and exit
-h, --help show this help message and exit
-p, --preview show a preview of the UI instead of generating code
-o FILE, --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
-i N, --indent=N set indent width to N spaces, tab if N is 0 [default:
4]

Code generation options:
--import-from=PACKAGE
generate imports of pyrcc5 generated modules in the
style 'from PACKAGE import ...'
--from-imports the equivalent of '--import-from=.'
--resource-suffix=SUFFIX
append SUFFIX to the basename of resource files
[default: _rc]
Reply
#3
(Sep-02-2019, 09:58 AM)Axel_Erfurt Wrote: pyuic4 input.ui -o output.py

or

pyuic5 input.ui -o output.py

Quote:Options:
--version show program's version number and exit
-h, --help show this help message and exit
-p, --preview show a preview of the UI instead of generating code
-o FILE, --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
-i N, --indent=N set indent width to N spaces, tab if N is 0 [default:
4]

Code generation options:
--import-from=PACKAGE
generate imports of pyrcc5 generated modules in the
style 'from PACKAGE import ...'
--from-imports the equivalent of '--import-from=.'
--resource-suffix=SUFFIX
append SUFFIX to the basename of resource files
[default: _rc]

I'm being told it's invalid syntax.
Reply
#4
go to your terminal

If you have Linux or OSX you can check if pyuic5 is installed

which pyuic5

adjust 'myfolder' to the path of your folder and myfile to the name of your file

cd myfolder

pyuic5 -x myfile.ui -o myfile.py
Reply
#5
(Sep-02-2019, 08:00 PM)Axel_Erfurt Wrote: go to your terminal

If you have Linux or OSX you can check if pyuic5 is installed

which pyuic5

adjust 'myfolder' to the path of your folder and myfile to the name of your file

cd myfolder

pyuic5 -x myfile.ui -o myfile.py

eh, nevermind. I'm not cut out for programming at all.
Reply
#6
You do not necessarily have to transform it.
You can load the ui file in your project.

How to Import a PyQt5 .ui File in a Python GUI
Reply
#7
Or even better do not use a UI file at all adding garbage code to a program functional or not is never really a good idea especially since making that UI code via normal pyqt methods is just as easy and is a whole lot easier to work with later on when you inevitably need to make adjustments or modifications to it. If you need help with doing this just holler out be more than happy to guide you in it otherwise enjoy the pain that dealing with garbage code is going to bring you.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020