Open banesullivan opened 4 years ago
This seems to be an internal, vtk
error. We can override it or protect it with a super
and catch the error.
I faced the same issue when using QVTKRenderWindowInteractor on a remote desktop, I opened an issue on VTK gitlab repo: https://gitlab.kitware.com/vtk/vtk/-/issues/17854
If anyone needs an urgent fix for this issue, this dirty workaround can do the job:
_getPixelRatio_BUG = QVTKRenderWindowInteractor._getPixelRatio
def _getPixelRatio_WORKAROUND(self):
try:
return _getPixelRatio_BUG()
except Exception as err:
print("Exception QVTKRenderWindowInteractor._getPixelRatio: {0}".format(err))
return Qt.QApplication.instance().devicePixelRatio()
setattr(QVTKRenderWindowInteractor, '_getPixelRatio_WORKAROUND', _getPixelRatio_WORKAROUND)
QVTKRenderWindowInteractor._getPixelRatio = _getPixelRatio_WORKAROUND
I added these lines to my main
function, right before calling app = Qt.QApplication(sys.argv)
Nice fix @zakaria220
@banesullivan, should we consider incorporating this into pyvista
? Perhaps in qt_plotting
? We can then conditionally add it for unpatched versions of vtk
.
Ah, that's a nifty little hack of a solution! Thanks, @zakaria220!
@akaszynski: I'm all for adding it directly into pyvista
and just overriding the method on our class rather than monkey-patching
VTK 9.0.0 has been released with a fix https://github.com/Kitware/VTK/releases/tag/v9.0.0
Click the camera and drag off screen then a crash happens: