Python Qt6 QML VTKRenderItem

Hi :-),
I want to use VTK with Pyside6 and QML. For C++ i found an example and with

QObject* topLevel = engine.rootObjects().value(0);
    QQuickWindow* window = qobject_cast<QQuickWindow*>(topLevel);

    QQuickVTKRenderItem* qquickvtkItem = topLevel->findChild<QQuickVTKRenderItem*>("ConeView");
    vtkRenderWindow *renderWindow = qquickvtkItem->renderWindow()->renderWindow();
    vtkRenderWindowInteractor *iRen = renderWindow->GetInteractor();
    vtkRenderer *renderer = qquickvtkItem->renderer();

on C++ side and

import QtQuick.Window
import VTK 9.3

Window {
    width: 600
    height: 600
    VTKRenderWindow {
        id: vtkwindow
        anchors.fill: parent
        VTKRenderItem {
         id: renderItem
         objectName: "ConeView"
         anchors.fill: vtkwindow
         renderWindow: vtkwindow

on QML Side, i get everything to use vtk.

But in Pyhon the VTKRenderWindow is just a QQuickItem and the Type QQuickVTKRenderItem does not exist.

So, how to use VTK in pyside6/qml apps ?

Thanks for help :slight_smile:

here is the link to the example : classQQuickVTKRenderItem. Sadly, The code does not work in Python :frowning:

Qt Quick allows you to create web-like UI on desktop. However, since VTK can now run in the web browser and you can run your C++ code (using webassembly) and Python code (for example using pyodide) natively in the web browser, too, you might consider cutting out Qt and use a web GUI framework instead (such as React or Angular).

Using Javascript framework instead of Qt for the GUI widgets may be very significant effort and most C++/Python on the web technologies are not mature yet, but the Qt company does not behave nicely (they make life of free Qt users increasingly more difficult; and licensing terms and costs for commercial Qt are unreasonable) and more and more users demand running their software natively in the browser. Therefore, web GUI should be seriously considered, especially for new projects and that can afford to use an evolving technology stack in the next few years.