Python third-party library

Source: Internet
Author: User
Tags image processing library wxwidgets

This article is reproduced in "Love butterfly blog !』
Http://blog.csdn.net/lanphaday

Today, the company has a power outage and is not on duty. I am going to update my blog and share with you some of my frequently used third-party Python libraries. The reason why the Python language is so popular is that in addition to many built-in libraries to ensure rapid development, third-party libraries that are not constantly connected are also a major cause. In combination with my current work (online game development), I usually use the following third-party libraries:

Wxpython
If you are a Windows programmer and use MFC or WIN32API to develop the interface program, the best GUI option for entering the python country should be wxpython. It is the python bind of wxWidgets, which is perfectly synchronized with wxWidgets development. The most important thing is that its message mechanism is quite similar to that of MFC, previous experiences in MFC can be applied to wxpython with slight changes. In Win32 development, the most annoying part must contain the wm_size message. It is troublesome to keep the control layout in Win32 when the size of the Main Window changes. The wx solution is perfect, and its sizer concept allows me to easily maintain a perfect control layout with different window sizes. In addition, if you hate the doc-view model of MFC, wx can also give you a new option. If you like the doc-view model very much, rest assured, it can still be easily implemented in Wx, and the previous ideas can still be used here.

Wxpython has two packages: pythoncard and Dabo. The former is a limited package of wxpython and does not support all features of wxpython. Its goal is to make wxpython more pythonic. The latter is much larger than pythoncard. Specifically, it should be a three-tier C/S mode development framework. If you want to develop database-based applications (such as MIS and ERP), using dabo is a good choice. In addition, if you are used to RAD development environments such as VB, VFP, and Delphi, dabo is not much worse than these expensive tools!

Py2exe
According to the evil windows thinking, if an application is not compiled. EXE files may not be "software", and py2exe serves your purpose. PY script.. ZIP file, but you can also modify setup. the py script packages all the scripts and dependent DLL files into one exe. It looks like the program compiled by VC and VB is no different!

If your customers need to use your applications in windows, py2exe is an indispensable tool. I use it to package gadgets written by wxpython for game planning in the company.

Psyco
The execution efficiency of the script is somewhat unsatisfactory. Although optimization is not difficult, it is worth noting if there is a simple method that almost does not need to modify the source code. The magic of psyco is that it only needs to call two lines of code at the entrance of the code, and the performance can be improved by 40% or more, which is truly immediate!

If your customer thinks your program is a little slow, don't rush to optimize the code. psyco may let him change his mind immediately. Psyco is called the python JIT and has a lot of potential to explore. If there is not much time to optimize the performance for you, please read its manual immediately. There are many ways to easily optimize the performance.

PIL
PIL is a python image processing library. In my opinion, Pil is so powerful that it is not easy to say. It can open dozens of image formats, including JPG, PNG, and BMP. In addition, it also provides many image processing functions, such as enhancement and filtering algorithms, for more information, see my previous article "using python for image processing" (http://blog.csdn.net/lanphaday/archive/2007/10/28/1852726.aspx) and "calculating image similarity" (http://blog.csdn.net/lanphaday/archive/2008/04/24/2325027.aspx ).

Mysqldb
This is Python's support for the open-source MySQL database. The official website is http://sourceforge.net/projects/mysql-python. Supports the full range of MySQL 3.23-5.1 and Python 2.3-2.5. Mysqldb is the implementation of Python dB API-2.0, and it is very mature now. The latest version is 1.2.2.

If you are engaged in server development, you should not deal with the database connection pool. In this case, you can use dbutils or jonpy open-source libraries. Among them, dbutils is a set of database connection pool libraries, while jonpy includes CGI and database connection pool among other functions. Please read the manual and select your own library.

Pyprocessing
The Gil (Global interpreter lock) in the python interpreter makes Python a bit awkward in the multi-core era-The scripting language that supports native threads cannot utilize multiple CPU cores for concurrent computing through multithreading. Pyprocessing does not try to remove Gil. Instead, pyprocessing tries to use multi-process methods to help Python get out of the predicament. The result is that the use of pyprocessing to create communication between processes is not only as simple as the use of the built-in threading module, or even easier. Pyprocessing not only can communicate with the pipeline through the local socket, but also can be encapsulated perfectly. Its Queue implementation is no different from the built-in queue implementation, but it is a queue shared between processes!

Pyprocessing has been used as a built-in module in py2.6 and py3.0. It is also an affirmation of the development community for the pyprocessing project. If you use python to develop server applications, especially those such as online games, how can you ignore pyprocessing!

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