[vtkusers] Using vtkLineWidget2 with PyQt

Oliver Natt onatt at gmx.de
Mon Dec 18 02:45:00 EST 2017

Dear vtkusers,

I found a solution to my problem: The problem is obviously caused by
python's garbage  collector. If I assign the vtkLineWidget2 to an
instance variable of the class MainWindow, it works as expected. The
same issue happens with other vtkWidgets, too.

I am interested to understand, why this actually happens. It is not a
problem for the vtkActor but only for the vtk...Widget. Something must
be fundamentally different between those classes which causes that the
vtk...Widget is garbage-collected although it is still needed by vtk.

Best regards,

Am 15.12.2017 um 12:02 schrieb Oliver Natt:
> Dear vtkusers,
> for some reason, I cannot manage to get a vtkLineWidget2 working in
> one of my PyQt-applications. Interestingly, the same code works well
> in a regular vtk-window. Please find attaced two python scripts. The
> first script "linewidget2_noQt.py" works exactly as expected: A yellow
> cylinder and the line widget is rendered. I can also interact with the
> widget by dragging the endpoints with the mouse. However, the same
> code embedded into a Qt-Window (cf. linewidget2_qt.py) does not work:
> The yellow cylinder is shown, but the line widget is missing.
> Do you have any suggestions how to get the vtkLineWidget2 working in a
> PyQt-application?
> Best regards,
> Oliver
> _______________________________________________
> 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
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vtk.org/pipermail/vtkusers/attachments/20171218/4672c7bf/attachment.html>

More information about the vtkusers mailing list