<div dir="ltr"><div><div><div><div><div>In QVTKRenderWindowInteractor, keyPressEvent and keyReleaseEvent are implemented as follows:<br><br>    def keyPressEvent(self, ev):<br>        ctrl, shift = self._GetCtrlShift(ev)<br>        if ev.key() < 256:<br>            key = str(ev.text())<br>        else:<br>            key = chr(0)<br><br>        keySym = _qt_key_to_key_sym(ev.key())<br>        if shift and len(keySym) == 1 and keySym.isalpha():<br>            keySym = keySym.upper()<br><br>        self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY,<br>                                            ctrl, shift, key, 0, keySym)<br>        self._Iren.KeyPressEvent()<br>        self._Iren.CharEvent()<br><br>    def keyReleaseEvent(self, ev):<br>        ctrl, shift = self._GetCtrlShift(ev)<br>        if ev.key() < 256:<br>            key = chr(ev.key())<br>        else:<br>            key = chr(0)<br><br>        self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY,<br>                                            ctrl, shift, key, 0, None)<br>        self._Iren.KeyReleaseEvent()<br><br></div>Notice how in keyPressEvent, key (the keycode passed to SetEventInformationFlipY) is constructed from str(ev.text()), which I find strange. Why use the .text() of the Qt event and not the keycode (.key())? SetEventInformationFlipY seems to expect a char a keycode.<br><br></div>In keyReleaseEvent it is constructed from chr(ev.key()), which I think looks right.<br><br></div>Is there some subtility I'm missing here, or is this just a mistake?<br><br></div>Thanks in advance,<br></div>Elvis<br></div>