Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to add python scripting into QT application?

Tags:

c++

python

qt

I have a QT 4.6 application (C++ language) and i need to add python scripting to it on windows platform. Unfortunately, i never embed python before, and it seems to be a lot of different ways to do so. Can anyone share his wisdom and point me into some articles/documentation i can read to perform a specified task in less painful way?

like image 366
grigoryvp Avatar asked Dec 15 '09 15:12

grigoryvp


People also ask

Can you use Python with Qt?

Qt for Python offers the official Python bindings for Qt, which enables you to use Python to write your Qt applications. The project has two main components: PySide6, so that you can use Qt6 APIs in your Python applications, and.

Can you use Qt design studio with Python?

To create a GUI for your windows and dialogs in PyQt, you can take two main paths: you can use Qt Designer, or you can hand code the GUI in plain Python code.

Is PyQt the same as Qt?

You can choose between two libraries for using Qt from Python: PyQt is mature but requires you to purchase a license for commercial projects. Qt for Python is a recent push by Qt the company to officially support Python. It's offered under the LGPL and can thus often be used for free.


2 Answers

Edit:

You can use PythonQt (not PyQt) that allow you to use Python with Qt. I think this is what you are searching for.

Here a documentation on the official website: http://doc.qt.digia.com/qq/qq23-pythonqt.html.

like image 197
Patrice Bernassola Avatar answered Sep 18 '22 12:09

Patrice Bernassola


You should take a look at PythonQt. From the homepage:

PythonQt is a dynamic Python binding for Qt. It offers an easy way to embed the Python scripting language into your Qt applications. It makes heavy use of the QMetaObject system and thus requires Qt4.x. In contrast to PyQt , PythonQt is not a complete Python wrapper around the complete Qt functionality. So if you are looking for a way to write complete applications in Python using the Qt GUI, you should use PyQt.

If you are looking for a simple way to embed Python objects into your C++/Qt Application and to script parts of your application via Python, PythonQt is the way to go!

Build/installation instructions for Windows is near the bottom of the page.

like image 36
Barry Wark Avatar answered Sep 19 '22 12:09

Barry Wark