Want to pass a QDomDocument to an embedded Python script
-
wrote on 26 Jan 2023, 13:29 last edited by
I'm trying to pass a QDomDocument to an embedded Python script. I believe I can use Py_BuildValue, but I can't find any good examples that show you how to pass your own object. Cany anyone point me to some good examples of this?
-
I'm trying to pass a QDomDocument to an embedded Python script. I believe I can use Py_BuildValue, but I can't find any good examples that show you how to pass your own object. Cany anyone point me to some good examples of this?
@kesterpm said in Want to pass a QDomDocument to an embedded Python script:
embedded Python script
In what way embedded? Is your app written in C++ and you're running a Python script inside your app?
-
wrote on 26 Jan 2023, 14:18 last edited by
Yes, my C++ app will look for python scripts to load. Events are customizable and will call a Python method if it exists. Basically the app allows you to extend it's functionality using Python.
-
Hi,
Are you planning to use PySide to manipulate your QDomDocument on the python side ?
If so, this example might be a starting point.
Hope it helps
-
wrote on 26 Jan 2023, 19:47 last edited by
Yes, that code has been written and tested. The trick is passing this custom datatype between c++ and python. I could send a string over and import it into a qdomdocument, but that seems really inefficient.
-
Maybe the code injection part will offer some insight for your use case.
-
Yes, that code has been written and tested. The trick is passing this custom datatype between c++ and python. I could send a string over and import it into a qdomdocument, but that seems really inefficient.
wrote on 16 Feb 2023, 17:56 last edited byThis post is deleted! -
Maybe the code injection part will offer some insight for your use case.
wrote on 16 Feb 2023, 17:58 last edited by@SGaist Yeah it seems like you need to create a wrapper in C++ somehow. I would think a wrapper exists already, but I can't find any good examples. I'm pretty close to just sending it as a string to python, then converting it to a QDomDocument in the embedded python. Thanks for pointing me to those documents.