<div dir="ltr">Hi Chen,<div><br></div><div>There should be no need to recompile VTK in order to use PySide. The only important file for using VTK with PySide (or with PyQt4 or PyQt5) is QVTKRenderWindowInteractor.py. Also, it's best to import it from vtk.qt, not from vtk.qt4 (which is obsolete).</div><div><br></div><div>My recommendation is to grab the latest version of this file from the VTK master branch:</div><div><a href="https://gitlab.kitware.com/vtk/vtk/raw/master/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py">https://gitlab.kitware.com/vtk/vtk/raw/master/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py</a><br></div><div><br></div><div> - David</div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 10, 2016 at 8:06 PM, hchen <span dir="ltr"><<a href="mailto:hjchen.work@gmail.com" target="_blank">hjchen.work@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I'm trying to figure out how to switch from PyQt4 to PySide for my VTK<br>
program. From what I heard, it should be straight forward. But, when I took<br>
the example:<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK/<wbr>Examples/Python/Widgets/<wbr>EmbedPyQt</a><br>
and replaced:<br>
from PyQt4 import QtCore, QtGui<br>
by:<br>
from PySide import QtCore, QtGui<br>
I got this error:<br>
self.vtkWidget = QVTKRenderWindowInteractor(<wbr>self.frame)<br>
File<br>
"/usr/local/lib/python3.5/<wbr>site-packages/vtk/qt/<wbr>QVTKRenderWindowInteractor.py"<wbr>,<br>
line 204, in __init__<br>
QWidget.__init__(self, parent, wflags|Qt.MSWindowsOwnDC)<br>
TypeError: QWidget(QWidget parent=None, Qt.WindowFlags flags=0):<br>
argument 1 has unexpected type 'PySide.QtGui.QFrame'<br>
<br>
Can anyone please points out why is the error and what's involved in making<br>
the switch? Do I need to remove PyQt and recompile VTK? And, I am on Ubuntu<br>
16.04, with VTK 7.0, Python 3.5, QT4.8, PyQt 4.11.4, PySide 1.2.2, but in<br>
the error, there is Qt.MSWindowsOwnDC, looks like it's for Windows?<br>
<br>
Thanks a lot in advance!<br>
<br>
Chen<br></blockquote></div></div></div></div></div></div>