[vtkusers] InfoVis: vtkGraphLayoutView in QVTK Widget
Eric E. Monson
emonson at cs.duke.edu
Mon Jun 29 11:38:53 EDT 2009
Hey Jeff,
Thanks for the quick reply. I tried (after updating to current CVS):
self.view = vtk.vtkGraphLayoutView()
self.view.SetInteractor(self.ui.vtkWidget.GetInteractor())
self.ui.vtkWidget.SetRenderWindow(self.view.GetRenderWindow())
but for some reason the GetInteractor() method doesn't seem to be
wrapped in Python. I tried to cheat it by calling:
self.view.SetInteractor(self.ui.vtkWidget._Iren)
and it ran but still popped up an extra render window as before...
I'll try looking through the page you referenced, but let me know if
you have any other ideas.
Thanks,
-Eric
On Jun 29, 2009, at 10:57 AM, Jeff Baumes wrote:
> Try the following, it should work. This is the result of some major
> view/representation refactoring that has taken place in VTK CVS. I'd
> like to avoid the need for the SetInteractor() call in the future,
> but currently it's necessary to avoid the popout on some systems.
>
> vtkRenderViewPtr->SetInteractor(qvtkWidget->GetInteractor());
> qvtkWidget->SetRenderWindow(vtkRenderViewPtr->GetRenderWindow());
>
> If you're interested in some discussion of the refactoring, look here
>
> https://www.kitware.com/InfovisWiki/index.php/View_Representation_Refactoring
>
> Jeff
>
> On Mon, Jun 29, 2009 at 10:44 AM, Eric E. Monson
> <emonson at cs.duke.edu> wrote:
> Hey again,
>
> I just tried to follow the Cxx EasyView and it still opens another
> render window with all of my graph stuff in it, and the QVTK widget
> just shows garbage from the last application that I ran (which here
> happens to be another PyQt4 app showing a cylinder that worked just
> fine -- screen shot attached).
>
> class SimpleView(QtGui.QMainWindow):
>
> def __init__(self, parent = None):
>
>
> QtGui.QMainWindow.__init__(self, parent)
> self.ui = Ui_MainWindow()
> self.ui.setupUi(self)
>
> self.view = vtk.vtkGraphLayoutView()
> self.ui.vtkWidget.SetRenderWindow(self.view.GetRenderWindow())
>
>
> I'm using OS X 10.5.7, Qt 4.4.3, VTK CVS from June 18th, Python 2.5.
>
> Thanks,
> -Eric
>
>
>
>
>
> On Jun 29, 2009, at 9:59 AM, Eric E. Monson wrote:
>
> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>
> --
> Jeff Baumes, Ph.D.
> R&D Engineer, Kitware Inc.
> (518) 881-4932
> jeff.baumes at kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090629/8c9fbd99/attachment.htm>
More information about the vtkusers
mailing list