[vtkusers] VTK 6.2 and PyQt5?

Elvis Stansvik elvis.stansvik at orexplore.com
Fri Feb 5 09:45:25 EST 2016


2016-02-04 19:01 GMT+01:00 David Gobbi <david.gobbi at gmail.com>:

> Hi Elvis,
>
> You should be able to copy the QVTKRenderWindowInteractor.py from
> the VTK master branch into your project (even rename it if you like) and
> then use it with any version of VTK.
>
> Just replace the two try/except blocks at the top of the file with this:
>
>     PyQtImpl = "PyQt5" # or "PyQt4" or "PySide"
>     QVTKRWIBase = "QWidget" # or "QGLWidget"
>
> You can think of this script as an example that that you can grab and
> and modify to suit your own purposes.
>

That worked great, except for a small issue with a missing
QWheelEvent::delta() in PyQt5 (see my merge request 1185).

However, with QWidget as base class, I'm getting some strange rendering.
With QGLWidget it looks fine.

See the attached screenshot. It shows the cone example from
QVTKRenderWindowInteractor.py with QWidget (left) and QGLWidget (right).
With QWidget, the cone faces seem partly transparent from some angles.

Any idea what might be going on? This is VTK 6.2.0, Kubuntu 15.10, on Intel
graphics (Thinkpad T440s).

Elvis


>
>  - David
>
>
>
> On Thu, Feb 4, 2016 at 8:16 AM, Elvis Stansvik <
> elvis.stansvik at orexplore.com> wrote:
>
>> Hi all,
>>
>> I have the same question as Alex on this list had in April last year:
>>
>>    http://markmail.org/message/i3e4dxwxqravlaf3
>>
>> Is it possible to use PyQt5 with VTK 6.2?
>>
>> I'm on a *buntu system, and the python-vtk6 package installs the
>> following Qt related files:
>>
>> estan at newton:~$ dpkg -L python-vtk6 | grep -i qt
>> /usr/lib/python2.7/dist-packages/vtk/qt4
>> /usr/lib/python2.7/dist-packages/vtk/qt4/QVTKRenderWindowInteractor.py
>> /usr/lib/python2.7/dist-packages/vtk/qt4/__init__.py
>> /usr/lib/python2.7/dist-packages/vtk/
>> vtkRenderingQtPython.x86_64-linux-gnu.so
>> /usr/lib/python2.7/dist-packages/vtk/vtkRenderingQt.py
>>
>> ldd on the .so shows it is linking against Qt 5, but is that enough. Or
>> must I have a QVTKRenderWindowInteractor that works with PyQt5 as well? It
>> seems a port of that class to PyQt5 was done only 5 months ago:
>>
>>    https://gitlab.kitware.com/vtk/vtk/merge_requests/101
>>
>> So would not be in 6.2 :/
>>
>> Are there really no software out there which uses PyQt5 + VTK and only
>> make use of packaged versions?
>>
>> Cheers,
>> Elvis
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160205/5a4d18f4/attachment.html>


More information about the vtkusers mailing list