Reprinted from Http://www.cnblogs.com/dalanjing/p/6978373.html, and made minor changes
1. Open cmd installation PyQt5
Pip Install Pyqt5
2,PYQT5 no longer provides tools such as QT Designer, so you need to install Pyqt5-tools
Pip Install Pyqt5-tools
3. Open Pycharm, enter settings, add external Tools
4, add Qtdesigner,designer.exe in the installation directory D:\ProgramData\Anaconda3\Lib\site-packages\pyqt5-tools\ Designer.exe, notice that the working directory is changed to make it easier.
5, set "Pyuic"-this is mainly used to convert the QT interface into the PY code
In the Pyuic settings, the other is the same, program writes to the Python address, parameters writes
-M PyQt5.uic.pyuic $FileName $-O $FileNameWithoutExtension $.py
The above complete Setup, the following simple example uses the method
6, New project
Using designer, after creating a new main window, use Pyuic to convert the Hello.ui file to hello.py
If in the 5th step, set Pyuic, working directory: This is not set to $filedir$, the above operation may be wrong.
7, add main.py because the UI file is named Hello, so import is Hello
1 ImportSYS2 ImportHello3 fromPyqt5.qtwidgetsImportqapplication, Qmainwindow4 5 if __name__=='__main__':6App =qapplication (SYS.ARGV)7MainWindow =Qmainwindow ()8UI =Hello. Ui_mainwindow ()9 ui.setupui (MainWindow)Ten mainwindow.show () OneSys.exit (App.exec_ ())
Pycharm+python+pyqt5 use