Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving the cursor into a mayavi window causes a crash #1298

Open
VoodooCode14 opened this issue May 1, 2024 · 0 comments
Open

Moving the cursor into a mayavi window causes a crash #1298

VoodooCode14 opened this issue May 1, 2024 · 0 comments

Comments

@VoodooCode14
Copy link

The following code:

import os

os.environ['ETS_TOOLKIT'] = 'qt6'

import mayavi.mlab
mayavi.mlab.test_plot3d()
mayavi.mlab.show()
quit()

leads to a crash, with the following error msg:

Traceback (most recent call last):
  File "/home/voodoocode/local_python/lib/python3.12/site-packages/tvtk/pyface/ui/qt4/QVTKRenderWindowInteractor.py", line 543, in mouseMoveEvent
    self.__saveX = int(ev.x()*pxr)
                       ^^^^
AttributeError: 'QMouseEvent' object has no attribute 'x'

Putting a breakpoint into line 59 of QVTKRenderWindowInteractor.py reveals that qt_api is (properly) set to pyqt6

This issue occurred after upgrading Python from 3.11 to 3.12.

This can be fixed as follows, changing lines 543, 544, 547, 547, 514, 514, 529, and 529 from

ev.x()

to

ev.position().x()

and

ev.y()

to

ev.position().y()

However, this will likely break earlier Qt versions (i.e. < 6) and needs corresponding handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant