enthought / enthought/mayavi

Moving the cursor into a mayavi window causes a crash

Open
#1,298 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.