[vtkusers] Interactive graph in QVTKRenderWindowInteractor (VTK 6.1/Python 2.7/Pyside)

Michka Popoff michkapopoff at gmail.com
Sun Mar 16 16:08:00 EDT 2014


I looked at your code, it’s quite long and does a lot of things with classes I never used, so it’s complicating the thing (and I have not the time to look at the 45 min long video) :D

I was able to set up the vtkcontextView like this : https://gist.github.com/iMichka/9588898, and it’s not crashing.

Some VERY important things :

- rename view to self.view … else it will be garbage collected at the end of the __init__, and will make the app segfault !
- you were setting vtk.vtkContextView() two times in the code, don’t do that, this also makes it crash.
- self.iren.Start() is not needed, as explained in the first example in the VTK wiki

Now you can try to adapt the new code to what you want to do. Perhaps go step by step, add the things you want to display first. Adding interactors and so can be done at the end.
Keep it as simple as possible to have a minimal working example.
If you come up with something I would be glad if you could share it, so we can have a new example in the wiki.

Michka

P.S. try to keep the discussion on the mailing list.

On 14 mars 2014, at 06:55, Noeska Smit <N.N.Smit at tudelft.nl> wrote:

> Thank you for you time! 
> I will keep trying things, I really hope it's just a simple hidden render call somewhere. I do have the feeling it's related to trying to use this vtkContextView with the QVTKRenderWindowInteractor, like maybe it can't handle that style of interaction. 
> 
> Noeska
> 
> 
> On Thu, Mar 13, 2014 at 10:54 PM, Michka Popoff <michkapopoff at gmail.com> wrote:
> The OpenGL errors are exactly the ones I got, that’s why I wrote the new examples in the first place.
> This is new in VTK 6 as the OpenGL error pipeline was rewritten. What previously (in VTK 5) was allowed is now no more allowed.
> 
> I even get segfaults when using your code on my Mac.
> The things is, there should be no call to Render() before the self.show() call. This is mandatory.
> 
> A fast look at your code did not reveal where the render call could be, so I’ll have to investigate.
> There is one more thing, I never tried to work with vtkContext so I don’t know if there is a conflict with the QVTKRenderWindowInteractor.
> 
> I’ll have a look at this this weekend so you may have to wait a little bit.
> 
> 
> Michka
> 
> On 13 mars 2014, at 22:14, Noeska Smit <noeska.smit at gmail.com> wrote:
> 
> > Thank you for your fast reply, Michka. The first example does run here, so I
> > believe the problem is related to using the 2D API with Qt.
> >
> > To double check this, I have rewritten that first example to include an
> > animated graph. A flurry of OpenGL errors start streaming and the animation
> > does not start. I can interact with the graph (pan and zoom) but I cannot
> > interact with the vertices to drag them around.
> >
> > This is the OpenGL error:
> > <http://vtk.1045678.n5.nabble.com/file/n5726307/opengl.png>
> >
> > I have included the adjusted PyQt example here:  graphexample.py
> > <http://vtk.1045678.n5.nabble.com/file/n5726307/graphexample.py>
> >
> >
> > Michka Popoff wrote
> >> Hi,
> >>
> >> QVTKWidget is not really tested I think, the preferred way is to use the
> >> QVTKRenderWindowInteractor.
> >>
> >> There are two examples I wrote with the help of the people here on the
> >> list, and by refactoring some older code.
> >> I personally us the first one.
> >>
> >> http://www.vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://vtk.1045678.n5.nabble.com/Interactive-graph-in-QVTKRenderWindowInteractor-VTK-6-1-Python-2-7-Pyside-tp5726303p5726307.html
> > Sent from the VTK - Users mailing list archive at Nabble.com.
> > _______________________________________________
> > 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
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140316/259cb578/attachment.html>


More information about the vtkusers mailing list