Convert .ui File .py - Python Forum

Python Forum Python Forum
  • View Active Threads
  • View Today's Posts
  • Home
  • Forums
    • View New Posts
    • View Today's Posts
    • My Discussions
    • Unanswered Posts
    • Unread Posts
    • Active Threads
    • Mark all forums read
  • Staff List
  • Member List
  • Help
  • Calendar
  • Search
  • Statistics
  • Interpreter
  • IRC
Convert .ui file .py
  • Python Forum
  • Python Coding
  • GUI
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes Convert .ui file .py
mailal Unladen Swallow Posts: 2 Threads: 1 Joined: Jul 2017 Reputation: 0 #1 Jul-15-2017, 05:42 PM 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 Reply Find Reply Barrowman Splitter Posts: 163 Threads: 13 Joined: Oct 2016 Reputation: 7 #2 Jul-15-2017, 08:35 PM 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 Reply Find Reply snippsat Administrators Posts: 7,398 Threads: 123 Joined: Sep 2016 Reputation: 511 #3 Jul-15-2017, 11:00 PM (This post was last modified: Jul-15-2017, 11:00 PM by snippsat.) 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-toolsI 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 Reply Find Reply mailal Unladen Swallow Posts: 2 Threads: 1 Joined: Jul 2017 Reputation: 0 #4 Jul-16-2017, 08:01 PM (This post was last modified: Jul-16-2017, 08:01 PM by mailal.) I do not have pyuic5.exe, do I need to this file? And I also do not have \Scripts\ (folder). Reply Find Reply Barrowman Splitter Posts: 163 Threads: 13 Joined: Oct 2016 Reputation: 7 #5 Jul-16-2017, 08:47 PM
(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. Reply Find Reply snippsat Administrators Posts: 7,398 Threads: 123 Joined: Sep 2016 Reputation: 511 #6 Jul-17-2017, 04:33 PM (This post was last modified: Jul-17-2017, 04:33 PM by snippsat.)
(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 Reply Find Reply Sophus Unladen Swallow Posts: 2 Threads: 1 Joined: Jul 2017 Reputation: 0 #7 Jul-26-2017, 05:06 PM (This post was last modified: Jul-26-2017, 05:06 PM by Sophus.) @mailal: Why do you want to convert *.ui-files? You can dynamically load the *.ui-files by using the uic in PyQt5. Example: from PyQt5 import uic, QtWidgets import sys class Ui(QtWidgets.QDialog):     def __init__(self):         super(Ui, self).__init__()         uic.loadUi('SomeUi.ui', self)         self.show() if __name__ == '__main__':     app = QtWidgets.QApplication(sys.argv)     window = Ui()     sys.exit(app.exec_()) Reply Find Reply Jagger Unladen Swallow Posts: 1 Threads: 0 Joined: Mar 2019 Reputation: 0 #8 Mar-25-2019, 08:05 AM I have an this error:Error: Permission denied: Reply Find Reply
Users browsing this thread: 1 Guest(s)
  • View a Printable Version
Forum Jump: Private Messages User Control Panel Who's Online Search Forum Home Python Coding -- General Coding Help -- Data Science -- Homework -- GUI -- Game Development -- Networking -- Web Scraping & Web Development General -- News and Discussions -- Tutorials ---- Tutorial Requests and Submissions ---- Python Installation and Execution ---- Fundamentals ---- Common pitfalls and what to do ---- Web Scraping ---- Web Tutorials ---- GUI tutorials ---- Game Tutorials ---- Networking Tutorials -- Code sharing -- Code Review -- Jobs Forum & Off Topic -- Board ---- Weekly Top Picks -- Bar Powered By MyBB, © 2020 Designed byrain. Forum Stats Contact Us Lite (Archive) Mode RSS Syndication Dark Light

User Panel Messages

Log Out My Profile Pay your profile a visit User Control Panel Do some changes on your profile My Messages View private messages unread Avatar Change avatar Signature Change signature
Announcements
Announcement #1 8/1/2020 Announcement #2 8/2/2020 Announcement #3 8/6/2020

Login to Python Forum

Enter your details to login to your account: Remember me Lost Password? Login Don't have an account yet? Sign Up! Linear ModeThreaded Mode

Từ khóa » Chuyển Ui Sang Py