# Alt key release doesn't always trigger: python 3.7, vtk8.2 and pyqt5

**URL:** https://discourse.vtk.org/t/alt-key-release-doesnt-always-trigger-python-3-7-vtk8-2-and-pyqt5/826
**Category:** Support
**Created:** [April 24, 2019, 4:06am UTC](https://discourse.vtk.org/t/alt-key-release-doesnt-always-trigger-python-3-7-vtk8-2-and-pyqt5/826 "2019-04-24T04:06:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![michaelhogg](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michaelhogg/32/4613_2.png) [@michaelhogg](https://discourse.vtk.org/u/michaelhogg)
#### Post date: [April 24, 2019, 4:06am UTC](https://discourse.vtk.org/t/alt-key-release-doesnt-always-trigger-python-3-7-vtk8-2-and-pyqt5/826/1 "2019-04-24T04:06:48Z")

</div>

Hi all,

I am developing an application in Python 3.7 with PyQt5 and vtk 8.2.0 on Windows 7 / 10. I have a custom interactor class derived from vtkInteractorStyleTrackballCamera. I have added observers for KeyPressEvent and KeyReleaseEvent into this class.

One of the keys I use is the ALT key. When the ALT key is pressed it _always_ registers the KeyPressEvent. However, it doesn’t always register the KeyReleaseEvent, which causes some issues. I have tested on multiple PCs, so it is not my dodgy keyboard!

Could there be something in the vtk source code that is causing this?

Thanks,  
Michael

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [April 25, 2019, 3:20am UTC](https://discourse.vtk.org/t/alt-key-release-doesnt-always-trigger-python-3-7-vtk8-2-and-pyqt5/826/2 "2019-04-25T03:20:37Z")

</div>

If you press and release Alt key on Windows then the focus may be taken away from the VTK interactor (and given to the window menu) so the interactor may not be notified about the release of the key. You might be able to confirm this or find out more if you add breakpoints in [QVTKInteractor](https://vtk.org/doc/nightly/html/classQVTKInteractor.html).
