Running python VTK examples inside paraview

Hello, new member here. I wonder if there is a documented way for running pure VTK examples from within the paraview python console and/or programmable source/filters.

For example, something like this.

import vtk
cone = vtk.vtkConeSource()
mapper = vtk.vtkPolyDataMapper()
actor = vtk.vtkActor()
window = vtk.vtkRenderWindow()

window.SetSize(500, 500)

interactor = vtk.vtkRenderWindowInteractor()

renderer = vtk.vtkRenderer()

# Setting the background to blue.
renderer.SetBackground(0.1, 0.1, 0.4)


Currently, although this works, it creates a new pyqt window on mac os. I wonder, if there is a documented way or examples to link this to paraview views and objects ?.

Thank You.

This is not supported at all.

You can run part of a VTK examples in a ProgammableSource (eveyrthing but the rendering part), although I’m not sure to see the point.

Okay, there are just really powerful widgets for tracing contours, etc. On image data. In any case even if it runs in a separate window its not a big deal.

Then I assume I can retrieve the data from the interaction as vtk polydata or even numpy arrays and append them to a PV source or filter for example ?


In any case even if it runs in a separate window its not a big deal.

It is unsupported. Even if it works, it can break at any point.