TypeError in wxVTKRenderWindowInteractor
Description
When pressing a key corresponding to unicode code 128-255 [1], the wxVTKRenderWindowInteractor
raises the following error:
Traceback (most recent call last):
File "<venv>\python\lib\site-packages\vtk\wx\wxVTKRenderWindowInteractor.py", line 593, in OnKeyUp
self._Iren.SetEventInformationFlipY(event.GetX(), event.GetY(),
TypeError: SetEventInformationFlipY argument 5: a string of length 1 is required
[1] For example Umlaut characters ä
,ö
,ü
Possible cause & resolution
I believe this is because, when converted to utf-8
via
key = 'ä' # offending key example
key.encode('utf-8')
the resulting byte string has length 2, not 1.
One possible resolution would be changing 256
to 128
in https://gitlab.kitware.com/vtk/vtk/-/blob/657c719a343fa25f73e7d31addb7db316bb5f9d7/Wrapping/Python/vtkmodules/wx/wxVTKRenderWindowInteractor.py#L563
and similar occurrences.
Other information
Platform found on:
- OS: Windows
- wxPython version: 4.2.0