Python3 GUI Development (PYQT5) installation and configuration:
- Download and install the Miniconda3, and install the Jupyter Note: It is best to close 360 antivirus software or add cmd to the trust, or run activate will have problems.
- Enter the workspace, download the installation PyQt5, need to use the mirror, or download the network very not to force.
Pip install-i https://pypi.tuna.tsinghua.edu.cn/simple pyqt5pip install-i https://pypi.tuna.tsinghua.edu.cn/simple Pyqt5-tools
- Start running QT Designer:
E:\miniconda3\envs\skypy3\lib\site-packages\pyqt5-tools>designer.exe
- Drag the window and buttons
- Point File->save
- When you save the. ui file, you need to convert it to a. py file and run the following command:
Python-m Pyqt5.uic.pyuic-o E:\PythonWorkSpace\PyQT\frist.py E:\PythonWorkSpace\PyQT\test.ui
- Found a first.py file was generated
- Open first.py file, and copy to Jupyter
Import sysfrom PyQt5 import Qtcore, Qtgui, Qtwidgetsclass Ui_mainwindow (object): Def setupui (self, MainWindow): Mainwindow.setobjectname ("MainWindow") mainwindow.resize (+) Self.centralwidget = Qtwidgets.qwidget (Ma Inwindow) self.centralwidget.setObjectName ("Centralwidget") Self.textbrowser = Qtwidgets.qtextbrowser (self.c Entralwidget) Self.textBrowser.setGeometry (Qtcore.qrect (+, 192)) Self.textBrowser.setObjectName ("t Extbrowser ") Self.pushbutton = Qtwidgets.qpushbutton (self.centralwidget) self.pushButton.setGeometry (Qtcore. Qrect (380, Max, Max, Max)) Self.pushButton.setObjectName ("Pushbutton") Mainwindow.setcentralwidget (self.central Widget) Self.menubar = Qtwidgets.qmenubar (MainWindow) self.menubar.setGeometry (qtcore.qrect (0, 0, 800, 23)) Self.menubar.setObjectName ("menubar") Mainwindow.setmenubar (self.menubar) Self.statusbar = qtwidgets. Qstatusbar (MainWindow) Self.statusbar.setObjectName ("StatusBar") Mainwindow.setstatusbar (Self.statusbar) Self.retranslateui (M Ainwindow) QtCore.QMetaObject.connectSlotsByName (MainWindow) def retranslateui (self, MainWindow): _transl ate = QtCore.QCoreApplication.translate Mainwindow.setwindowtitle (_translate ("MainWindow", "MainWindow")) se Lf.pushButton.setText (_translate ("MainWindow", "click")) if __name__ = = ' __main__ ': app = Qtwidgets.qapplication (sys.a RGV) MainWindow = Qtwidgets.qmainwindow () UI = Ui_mainwindow () ui.setupui (MainWindow) mainwindow.show () sy S.exit (App.exec_ ())
window appears, configuration complete!
Python3 GUI Development (PYQT) installation and configuration