Add these, they are the modules that contain the platform-specific implementions of vtkRenderWindow and vtkRenderWindowInteractor:
import vtkmodules.vtkRenderingOpenGL2
import vtkmodules.vtkRenderingUI
Without these, calling vtkRenderWindow()
and vtkRenderWindowInteractor()
creates objects that can’t render or interact because they can’t talk to the display.
But after importing e.g. vtkRenderingOpenGL2, vtkRenderWindow()
will return an instance of the appropriate vtkRenderWindow subclass for rendering with OpenGL on your operating system. This is due to VTK’s factory mechanism. It’s a “feature” of VTK that you can override vtkRenderWindow by dynamically importing a module.