I'm interested in integrating PythonQt to expose wrapped objects, but I'm intrigued by the idea of using other Cython modules which expose C++ classes to Python. This got me thinking if it's possible to use PythonQt to embed Python, and also take advantage of Cython-wrapped classes at the same time.
Does anyone know if it is possible to have a QObject-inherited method that returns a Cython-type and for all the type-conversions to work transparently? Would I need to write CPython extensions to translate these objects?
For example, if I register a QObject through PythonQt::register..., and this class had a slot which returns a Numpy array (since Numpy is a Cython library now), would the PythonQt interpreter be able to understand this slot and expose it to Python?
-Taehee
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can pass a PyObject pointer as slot argument and as return value, so yes, you can use any Python objects in you slots, but you have to do the type checking yourself to verify that the arguments have the types that you expect.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm interested in integrating PythonQt to expose wrapped objects, but I'm intrigued by the idea of using other Cython modules which expose C++ classes to Python. This got me thinking if it's possible to use PythonQt to embed Python, and also take advantage of Cython-wrapped classes at the same time.
Does anyone know if it is possible to have a QObject-inherited method that returns a Cython-type and for all the type-conversions to work transparently? Would I need to write CPython extensions to translate these objects?
For example, if I register a QObject through PythonQt::register..., and this class had a slot which returns a Numpy array (since Numpy is a Cython library now), would the PythonQt interpreter be able to understand this slot and expose it to Python?
-Taehee
You can pass a PyObject pointer as slot argument and as return value, so yes, you can use any Python objects in you slots, but you have to do the type checking yourself to verify that the arguments have the types that you expect.