user2180977
user2180977

Reputation: 411

Easy way to create a python interpreter widget in a Qt C++ app?

My app is written in C++. I use Qt for the GUI. I have built python bindings for the the core of my app.

I would like to create an interpreter widget that would let the user access an embedded python interpreter where they can use my own python bindings to script operations available in the app.

The widgets I've been able to find online all assume one is using PyQt, but I want to do this in straight C++/Qt. Has anybody developed a Qt widget in C++ that I could reuse?

Upvotes: 0

Views: 873

Answers (1)

Radu Chivu
Radu Chivu

Reputation: 1065

AFAIK Qt does not provide a way to do that right now through a standard Qt component, there is a library called PythonQt that tries to accomplish what you need, but it only supports Qt 4. If that is acceptable then go for it, otherwise, you should download the python source code, compile it and then start here to see how to embed the interpreter in your application.

If you also want to expose parts of your application to the interpreter, you will have to use the Python C api to create a wrapper, you might be able to use SWIG to minimize the amount of work you have to do

Upvotes: 2

Related Questions