Python3 GUI Development (PYQT) installation and configuration

Source: Internet
Author: User
Tags jupyter qt designer

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_ ())
    • Start the program

window appears, configuration complete!

Python3 GUI Development (PYQT) installation and configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.