PYQT Development Tutorials-building environments and development examples

Source: Internet
Author: User
Tags qt designer

Building environments and development examples

* Installation

Install package

To correspond to a Python version

32-bit installation package (on my PC)

Http://jaist.dl.sourceforge.net/project/pyqt/PyQt4/PyQt-4.11.2/PyQt4-4.11.2-gpl-Py2.7-Qt4.8.6-x32.exe

or 64-bit installation package

Http://jaist.dl.sourceforge.net/project/pyqt/PyQt4/PyQt-4.11.2/PyQt4-4.11.2-gpl-Py2.7-Qt4.8.6-x64.exe

installation directory

Specify a python directory, such as C:\Python27\

Run

Reference http://www.pythoner.com/111.html

* Use

API documentation See here

Simple UI Development

Edit code manually

Practical UI Development

–ERIC4/ERIC5 provides UI editing capabilities

Http://nchc.dl.sourceforge.net/project/eric-ide/eric5/stable/5.5.0/eric5-5.5.0.zip

– Installation (Windows)

1. Unzip to eric5-5.5.0

2. Execute Python install.py under eric5-5.5.0/command line

– Start

1. Under eric5-5.5.0/eric/, double-click Eric.pyw

–QT Designer

– Edit UI, generate Xxx.ui file

– Generate py code with UI files

Pyuic4-o file name. py Project name. UI

The-X option indicates whether additional test code is generated to display the window, and it is recommended that this parameter be added so that it is easy to debug and run directly.

– The generated PY file

Contains the Ui_dialog class as the interface description code

– can be edited directly as the project master file

Run if you add the following code

If__name__ == "__main__":  ImportSys App= Qtgui.Qapplication(Sys.Argv)  Dialog = Qtgui.Qdialog()  ui = ui_dialog ()   ui. (dialog)  < Span class= "PLN" > dialog. ()   sysexit (app.exec_ ())    

Packaged

–py2exe packaged as EXE

– Installation (Windows)

Download the corresponding Python version of the installation package

Http://ncu.dl.sourceforge.net/project/py2exe/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe

– Dependent

MSVCP90.dll (I don't know why I just want this file, the other MSVCPxxx.dll doesn't seem to work)

Placed under the C:\Windows\System32

– Using the project directory where you want to package the file, double-click Execute when you want to package, generate the executable file under dist/(the name specified in the file setup.windows)
"" "FileName qt_pkg_tools.py, the following is the source code" "" #!/usr/bin/env python #coding =utf-8 FromDistutils.coreImportSetupImportPy2exeImportSys#this allows to run it has a simple double click.Sys.argv.append (' Py2exe ')Py2exe_options= {  "Includes": ["Sip"],  "Dll_excludes": ["MSVCP90.dll",],  "Compressed": 1,  "Optimize": 2,  "ASCII": 0,  "Bundle_files": 1,  } Setup ( name =  ' PyQt Demo ' , version = Span class= "string" > ' 1.0 ' , windows = [ ' pyqtdemo.py ' ,], ZipFile = none, Options = { ' Py2exe '  :  Py2exe_options} )     

* FAQ

Run-time fails after packaging

After the package is executed, sometimes it prompts for missing MSVCP90.dll, removes the dist/directory, and rebuilds it.

Http://www.seanyxie.com/pyqt%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B-%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83%E5%92%8C %e5%bc%80%e5%8f%91%e7%a4%ba%e4%be%8b/

PYQT Development Tutorials-building environments and development examples

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.