C + + extension framework based on Python plugin

Source: Internet
Author: User

Here is a typical C + + application framework that is extended using Python. such as Gimp/blender/qgis and so on Linux above the open source software, there are many commercial software also adopted this technology route. However, because of the flexibility of Python, you can use direct-C + + extensions, or scale based on Swig, PyQt, PYTHONQT, resulting in significant differences in implementation. This article describes a writer groping the use of Qt+sip+pyqt+python technology route, is a powerful, mature technology, packaging a relatively small amount of work, and has a commercial-grade development potential.

Most of the Python plugin introduction is about Python itself, because Pytho is a dynamic language, it is not difficult to achieve this, but in many applications, the performance requirements are high, generally need to be implemented in C/S. The Python interpretation engine is then embedded to make it easy for the user to customize the parameters, function extensions and module assembly.

In general, we encapsulate the C + + class of the main program through SIP, which can then be called directly through Python in the Python shell.

The Python console is then integrated into the main program window to control the operation of the main window directly through Python. There are two things to do here, one is to embed the console window in the main window, and the other is to pass the object handle of the main program to the Python interpreter environment. If initialized by Python, the object of the main window and the object of the interpreter are not the same and cannot be manipulated with each other. Of course, the main program can also be shared through global static objects, but it is not recommended to affect the scalability of subsequent programs.

(not to be continued)


C + + extension framework based on Python plugin

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.