import sys
// Now append the path of the python wrapping, which comes in the source code.
// Alter the path according to your own path.
sys.path.append("C:\Qt\vtk-5.4.2\Wrapping\Python")
//Import the vtk module
import vtk
import vtk
class StartMain(QtGui.QMainWindow):
# no parent, i.e. is top level widget
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_main()
self.ui.setupUi(self)
self.ui.meshDisplayWidget = QVTKRenderWindowInteractor(self.ui.meshDisplay) self.ui.meshDisplayWidget.Initialize()
//Set actors and mappers, then instead of creating a renderwindowinteractor,
// use the self.ui.meshDisplayWidget to display the mesh. Also define picker, and
// set data source (for code about displaying a mesh from coordinates, as
// an unstructured grid.
ren = vtk.vtkRenderer()
ren.AddActor(aMeshActor)
ren.AddActor2D(textActor)
ren.AddActor(dotActor)
ren.ResetCamera()
cam1 = ren.GetActiveCamera()
self.ui.meshDisplayWidget.GetRenderWindow().AddRenderer(ren)
self.ui.meshDisplayWidget.SetPicker(picker_point)
self.ui.meshDisplayWidget.show()