[vtkusers] InfoVis: vtkGraphLayoutView in QVTK Widget

Eric E. Monson emonson at cs.duke.edu
Mon Jun 29 09:59:20 EDT 2009


Hello,

I have a little Python/PyQt4 app that I made about six months ago to  
view graphs using the Titan classes. A vtkGraphLayoutView should show  
up in a QVTK Widget which I placed using Designer, but now with CVS  
VTK I get a separate RenderWindow popping up showing my graph...

vtkGraphLayoutView used to have a SetupRenderWindow() method, so I  
used to set things up by:

         QtGui.QMainWindow.__init__(self, parent)
         self.ui = Ui_MainWindow()
         self.ui.setupUi(self)

         self.ren = vtk.vtkRenderer()
         self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)

         [...]

         self.view = vtk.vtkGraphLayoutView()
         win = self.ren.GetRenderWindow()
         self.view.SetupRenderWindow(win)

Now if I just take out the view.SetupRenderWindow(win) call, I get a  
separate RenderWindow popping up and the QVTK widget is all black. I  
tried reordering the calls to something like this:

         self.view = vtk.vtkGraphLayoutView()
         self.ren = self.view.GetRenderer()
         self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
         self.win = self.ui.vtkWidget.GetRenderWindow()

Then the graph shows up in BOTH the extra window and my QVTK Widget.

I know I'm just ignorant about the correct method -- can anybody help  
me set up a vtkGraphLayoutView in a QVTK Widget properly?

Thanks a lot,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group





More information about the vtkusers mailing list