Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert .ui file .py
#1
Hi

I am experiencing an issue regarding to convert an .ui file to .py.

I am running QT Designer 3.6 with PyQt5. I have tried the below commands for converting but I still cannot get it right.

C:\Python35\Lib\site-packages\PyQt5>pyuic5 -o FirstApp.py FirstApp.ui
C:\Python35\Lib\site-packages\PyQt5>pyuic5 -o FirstApp.ui FirstApp.py
C:\Python35\Lib\site-packages\PyQt5>pyuic5 -x FirstApp.ui -o FirstApp.py
C:\Python35\Lib\site-packages\PyQt5>pyuic5.bat -x FirstApp.ui -o FirstApp.py
C:\Python35\Lib\site-packages\PyQt5>pyuic5.bat --execute FirstApp.ui -o FirstApp.py
C:\Python35\Lib\site-packages\PyQt5>pyuic5.bat --execute FirstApp.ui --output FirstApp.py

When I check in the folder PyQt5, there is only .ui file and the .py is not created. Can someone please help with this issue.

Kind regards
Mpho
Quote
#2
You need to find where pyuic5.exe is. Probably in C:\Python36\Scripts\
Then if that's where it is I think you need to do :
C:\Python36\Scripts\pyuic5.exe -o FirstApp.ui FirstApp.py
Quote
#3
Quick test,with use of virtual environment.
C:\1
λ python -m venv pyqt_5
λ cd pyqt_5
λ C:\1\pyqt_5\Scripts\activate.bat

# Environment is active,install into it
(pyqt_5) C:\1\pyqt_5\Scripts
λ pip install PyQt5
# pyqt5-tools for designer 
λ pip install pyqt5-tools
I start designer.exe
C:\1\pyqt_5\Lib\site-packages\pyqt5-tools\designer.exe
I save my test.ui in C:\1\pyqt_5\Scripts
So now is test.ui and pyuic5.exe in same folder.
Test and app.py is made correct.
(pyqt_5) C:\1\pyqt_5\Scripts
λ pyuic5.exe test.ui -o app.py
Quote
#4
I do not have pyuic5.exe, do I need to this file?

And I also do not have \Scripts\ (folder).
Quote
#5
(Jul-16-2017, 08:01 PM)mailal Wrote: I do not have pyuic5.exe, do I need to this file?

And I also do not have \Scripts\ (folder).

Well how sure are you that you don't have it. It could be somewhere else on your system and if it's not in your PATH it will not run unless you give the full path to it.
Quote
#6
(Jul-16-2017, 08:01 PM)mailal Wrote: And I also do not have \Scripts\ (folder).
All Python installation on Windows shall have a Scripts folder.
It's C:\Python35\Scripts for 3.5.

Quote:I do not have pyuic5.exe, do I need to this file?
It may be different on how you install,you should use pip(version-9) as do in demo.
You see usage of pip last in this tutorial.
pip install PyQt5
# pyqt5-tools for designer 
pip install pyqt5-tools
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)