Vedo: Error when closing PyQt application

Created on 18 Sep 2019  路  7Comments  路  Source: marcomusy/vedo

I am using vtkplotter in my PyQt5 application. When I close the application, a window shows up which contains some errors I can't understand.
I also tried the qt_window.py example but I got the same error.
A screenshot of the error is attached.

Is there any way to solve this?

error

bug

Most helpful comment

Hi hmralavi,

I had the same problem. Running the following when closing the qt application solved the problem for me:

during the qt-onClose event:

def shutdown_qt(self):
"""Stops the renderer such that the application can close without issues"""

    if self.vtkWidget:
        ren = self.vtkWidget.GetRenderWindow()
        iren = ren.GetInteractor()
        ren.Finalize()
        iren.TerminateApp()

All 7 comments

Hi, unfortunately I cannot reproduce the problem and I don't have an easy fix... the issue seems related to Windows OS with Intel graphics drivers:
https://discourse.vtk.org/t/wglmakecurrent-failed-in-makecurrent/1516
https://discourse.vtk.org/t/visible-cell-selection-hardwareselector-py-example-is-not-working-reliably/1262/12
https://discourse.vtk.org/t/problem-with-view-update-since-intel-uhd-graphics-620-driver-update/1224/5

You may try to:

  • rebuild VTK with different flags (uncommenting the lines as indicated in the above threads).

It doesn't seem to be an intel graphic issue because:

  1. I tested the https://vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt on both intel and nvidia graphics and got no errors.

  2. I tested the https://github.com/marcomusy/vtkplotter/blob/master/examples/other/qt_window.py on both intel and nvidia graphics and got the same errors as I mentioned.

I also tried to use this suggestion: https://discourse.vtk.org/t/visible-cell-selection-hardwareselector-py-example-is-not-working-reliably/1262/6, but I couldn't find the _vtkWin32OpenGLRenderWindow.cxx_ file.

OK, I will see if I can reproduce it on a windows machine.

Hi hmralavi,

I had the same problem. Running the following when closing the qt application solved the problem for me:

during the qt-onClose event:

def shutdown_qt(self):
"""Stops the renderer such that the application can close without issues"""

    if self.vtkWidget:
        ren = self.vtkWidget.GetRenderWindow()
        iren = ren.GetInteractor()
        ren.Finalize()
        iren.TerminateApp()

Thanks @RubendeBruin for addressing this! Unfortunately I didn't have much time lately to investigate it!

@RubendeBruin thanks for the tip.
I also use the following command in Qt closeEventand the problem solves.
self.vtkWidget.close()

@hmralavi : Indeed self.vtkWidget.close() also does the trick and is shorter.

Implemented in pull-request #60

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jby1993 picture jby1993  路  6Comments

Jesse0818 picture Jesse0818  路  4Comments

FedeClaudi picture FedeClaudi  路  7Comments

kemo993 picture kemo993  路  6Comments

mahendra-ramajayam picture mahendra-ramajayam  路  3Comments