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?

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:
It doesn't seem to be an intel graphic issue because:
I tested the https://vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt on both intel and nvidia graphics and got no errors.
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
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"""