Search code examples
pythonpython-3.xqmlpyqtgraph

How to embed PyQtGraph in QML with a PySide2 Python Backend?


Due to license restrictions I do not want to use QTCharts, so I am looking at PyQtGraph library.

I am working with PySide2 and QML. I am having difficulty getting a simple example working using QML because I don't know where to start. How do I embed one of these charts from the Python/Pyside2 backend to the QML front end?

Do I need to use a QQuickWidget somehow? Anyone have any examples of how to do this?

Can someone please point me in the right direction? Thank you


Solution

  • pyqtgraph is based on QGraphicsView which is part of the Qt Widgets submodule, so what you are asking for is equivalent to asking that a Qt Widget be embedded in QML and that is not possible. QQuickWidget does the opposite, ie embed a QML in a Qt Widget. In conclusion you can not.