# QVTKRenderWindowInteractor要求必须有初始化好的parent
def CreateScene(self, parent):
view = QVTKRenderWindowInteractor(parent)
renderer = vtkRenderer()
view.GetRenderWindow().AddRenderer(renderer)
renderer.SetBackground(1,1, 1)
view.GetRenderWindow().Render()
actor = vtkContextActor()
renderer.AddActor(actor)
scene = actor.GetScene()
scene.SetRenderer(renderer)
layout = QVBoxLayout()
layout.setContentsMargins(0,0,0,0)
layout.addWidget(view)
parent.setLayout(layout)
self.view = view
return scene
时间: 2024-09-28 21:57:19