Big secrets about Python programs

Source: Internet
Author: User

However, the author of this subclass needs to understand Logger very accurately. what has log_timestamp () done, and unless it is completely overwritten in the subclass. the log_timestamp () method does not call the parent method. Otherwise, the message cannot be removed.

A very basic PyQt application always has some sample code, which is the same everywhere, as does Tkinter code. However, when we further study the Code required to set up the application and display the code of the window component, the difference is displayed.

Toolkit is a widely used cross-platform GUI toolkit that can be used on Windows, Linux, Mac OSX, and many handheld platforms. QT has a well-structured but flexible object-oriented structure, clear documentation, and intuitive APIs.

In general, selecting a GUI toolbox for an application is tricky. A programmer can use a wide variety of GUI toolboxes, and each toolbox has its own advantages and disadvantages.

Some are faster and smaller than other toolboxes; some are easy to install, and some are more suitable for cross-platform use. In addition, some support specific features that you need to meet ). Of course, various databases have various licenses.

For Python programmers, the default GUI option is to bind Tk through Tkinter.)-The reason is obvious. Tkinter and idle IDE are compiled by the Python founder. They appear as the default choice for most Python distributions. The standard Python document discusses Tkinter, but does not involve any other GUI bindings. This is intentional!

At least so, if Tk and Tkinter are not so bad, programmers have no reason to look for alternatives. To induce a Python programmer to give up the default option, the toolbox must provide additional information. PyQt is such a toolbox. PyQt has many advantages over Tkinter and has several disadvantages ). Qt and PyQt are both fast; the design of Qt and PyQt is completely object-oriented;

Qt provides a well-designed set of window components, which is much larger than Tk. In terms of its disadvantages, Qt licenses are more restricted than many toolkit at least on non-Linux platforms); correct installation of Qt and PyQt is often complicated; in addition, qt is a very large library. Users of the PyQt application will need to try to install Qt and PyQt, which makes distribution very difficult.

PyQt strictly follows the licensing of Qt. In particular, it can be used for GPL on UNIX/X11 platforms and for Qt Palmtop Environment environments on Zaurus. There are also free-as-in-free-beer Windows software packages for older Qt versions. PyQt commercial licenses can be used for Windows.

For this article, PyQt is better than many other toolboxes and deserves our special attention. Qt uses a mechanism called signal/slot signals/slots) to transmit events and messages between window components and other objects.

This mechanism is totally different from the callback mechanism used by most toolboxes, including Tkinter. It is much easier to control communication between objects using signal/slot in a flexible and maintenance manner than to use a fragile callback style. The larger the application, the more important this advantage of Qt.

  1. How to embed Python into C ++ applications?
  2. In-depth discussion of Ruby and Python syntax comparison
  3. Introduction to Python
  4. Python Learning Experience: version, IDE selection and coding Solutions
  5. Analysis of Python GIL and thread security

Related Article

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: 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.