Follow ghost Brother to learn pyqt part.1

Source: Internet
Author: User

I don't go out for a few days during the Mid-Autumn Festival. I will stay at home and learn the pyqt related materials. Here I will only record the relevant learning records and keep them archived for later reading. The main purpose is to compile a decompilation and decompilation tool. Later, you can add some search and modification functions as needed to handle Automatic cracking of some games, for details about features similar to mm and other payments, see.


I feel that I may have some reference for beginners, so I will sort it out and post it to my blog. The text is all the notes left in the study, so there will certainly be a lot of code in the book. I would like to thank those authors for making the later scholars less detours.


0x1: pyqt introduction:

Pyqt is a toolkit for creating GUI applications. It is a successful combination of the python programming language and the QT library. The QT library is one of the most powerful Libraries currently. Pyqt is developed by Phil Thompson and implements a python module set. It has over 300 classes and nearly 6000 functions and methods. It is a multi-platform toolkit that can run on all major operating systems, including UNIX, windows, and Mac. Pyqt adopts a dual license. developers can select GPL and commercial license. Previously, the GPL version was only available on Unix. Starting from pyqt version 4, the GPL license was available for all supported platforms.

 

0x2: Prepare the configuration Environment

The Python version we use here is 2.7.8, and the corresponding pyqt version is 4.11.1. Below are the two official websites:

Https://www.python.org/downloads/

Http://pyqt.sourceforge.net

Below I sorted it out and put it on Baidu's online storage:

Http://pan.baidu.com/s/1dD1o5qT

 

If the two software are 32-bit, they can run in a 64-bit computer environment. Both Windows 7 and Windows 8 have been tested.

 

0x3: introduction to some learning Websites

Http://www.riverbankcomputing.com

Http://wiki.woodpecker.org.cn/moin/PyQt

Http://www.commandprompt.com/community/pyqt/book1

Http://wiki.python.org/moin/PyQt

Http://code.google.com/p/pyqt-doc-cn/

At the same time, I uploaded a classic English document on the Baidu online storage:

Prentice. Hall. Rapid. Gui. Programming. With. Python. And. QT. The. Definitive. Guide. to. pyqt. Programming

Beginners like me can read more of these materials.

 

0x4: write the first program

Create a simple window program:


Import sys ''' here we must reference it. The basic GUI control is located in the qtgui module. ''From pyqt4 import qtgui ''' each pyqt4 application must create an application object. The application object is located in the qtgui module. The sys. argv parameter is a list of parameters returned from the command line. Python scripts can be run from shell. This is a method for starting the script. '''App = qtgui. qapplication (SYS. argv) ''' the qwidget control is the base class of all user interface objects in pyqt4. We provide the default constructor for qwidget. The default constructor does not have a parent class. A control without a parent class is called a window. '''Widget = qtgui. qwidget () ''' the resize () method can be used to adjust the widget size. Here, the width is 250px and the height is 150px. '''Widget. Resize (250,150) ''' here we specify the title of our window. The title is displayed in the title bar. '''Widget. setwindowtitle ('Love guige, love python') ''' show () controls on the screen. The '''widget. Show () ''' SYS. Exit () method ensures a clean exit. The environment displays the '''sys.exit(app.exe C _())


The notes have been written above, which are more detailed and can be understood by referring to the arrangement made in some books. The running effect is as follows;




A simple interface program is completed, so we will continue to explore the next section to add two buttons and let them execute some functions.


Follow ghost Brother to learn pyqt part.1

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.