[vtkusers] GUISupport python wrappers?
Amos Anderson
amos.anderson at protabit.com
Fri Nov 29 13:45:00 EST 2013
On Nov 22, 2013, at 1:09 PM, Michka Popoff <michkapopoff at gmail.com> wrote:
> Hi
>
> FYI if you use QVTKRenderWindowInteractor, I wrote some examples how to embed vtk in a PyQt app (with the help of some people here on the list).
> In the first example you have also some explanations on why the code has to be written like this.
>
> http://www.vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt
> http://www.vtk.org/Wiki/VTK/Examples/Python/Widgets/EmbedPyQt2
>
> This could help you for PySide if you try to embed VTK.
> I would be glad to have some input from you to know if this works as nicely with PySide as with PyQt (I can then update the wiki telling people it’s also working / or not working with PySide).
Hi Michka!
Both of these demos are working for me with VTK 6.0.0 and PySide 1.2.1.
>
> Some more thoughts about the QVTKWidgets : The following part applies only to VTK 5.10.1, I did not test it with VTK 6, and as David Gobbi said these options seem to be gone in VTK 6 :
> You can check out this discussion I had on the bug tracker about the QVTKWidgets (1 and 2). Look at the very end of the discussion
> http://vtk.org/Bug/view.php?id=13983
> In cmake, use VTK_USE_QVTK_QTOPENGL:BOOL=ON, to have QVTKWidget2 in python
> With VTK_WRAP_PYTHON_SIP I think you will get only the QVTKWidget (1).
>
I don't need those QVTKWidgets per se... I had just assumed from the class name that QVTKRenderWindowInteractor wasn't a Qt widget, and that in order to add VTK to my Qt app I needed a "proper" widget. But seeing EmbedPyQt, I don't think I need that anymore because the segfaults I was experiencing seem to be gone...
someone should put EmbedPyQt into VTK/Examples/GUI/Qt!
Thanks!
Amos.
>
> On 22 nov. 2013, at 21:50, Amos Anderson <amos.anderson at protabit.com> wrote:
>
>> Hi David --
>>
>> I've only been using VTK 6 because it's a new project, and I don't think it includes the option VTK_WRAP_PYTHON_SIP. Has it been renamed?
>>
>> Ok, I'll stick with QVTKRenderWindowInteractor.py for now.
>>
>> Thanks!
>> Amos.
>>
>>
>>
>> On Nov 22, 2013, at 12:40 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>>> Hi Amos,
>>>
>>> Were you using these classes with python in VTK 5?
>>>
>>> I'm wondering if you were using the SIP wrappers, which were an extension
>>> of the python wrappers to help the QVTK classes integrate with PyQt.
>>> In VTK 6 and can be turned on with VTK_WRAP_PYTHON_SIP, as was
>>> also the case in VTK 5.
>>>
>>> However, no one is maintaining the SIP wrappers anymore, so I do not know
>>> if they still work, and if they do, I do not know if they work with PySide.
>>>
>>> - David
>>>
>>> On Fri, Nov 22, 2013 at 12:44 PM, Amos Anderson
>>> <amos.anderson at protabit.com> wrote:
>>>> Hi Aashish and David --
>>>>
>>>> Thank you both for your responses!
>>>>
>>>> I have been using PySide. Do I need PyQt for the GUISupport wrappers, or has
>>>> someone provided a way to obtain the wrappers with pyside?
>>>>
>>>> Thanks!
>>>> Amos.
>>>>
>>>>
>>>>
>>>>
>>>> On Nov 22, 2013, at 11:36 AM, Aashish Chaudhary
>>>> <aashish.chaudhary at kitware.com> wrote:
>>>>
>>>> Hi Amos,
>>>>
>>>> QVTK* modules are not wrapped in VTK. But you can use pyside and pyqt4 for a
>>>> VTK - QT application in python.
>>>>
>>>> - Aashish
>>>>
>>>>
>>>>
>>>> On Fri, Nov 22, 2013 at 1:10 PM, Amos Anderson <amos.anderson at protabit.com>
>>>> wrote:
>>>>>
>>>>> Hello VTK Users --
>>>>>
>>>>> How to I get GUISupport python wrappers in vtk 6? I can find a lot of
>>>>> testing/example python code that uses them (e.g. in
>>>>> GUISupport/Qt/Testing/Python) but my vtkpython doesn't have them:
>>>>>
>>>>>
>>>>>> vtkpython
>>>>>>>> import vtk
>>>>>>>> vtk.QVTKWidget2()
>>>>> Traceback (most recent call last):
>>>>> File "<stdin>", line 1, in <module>
>>>>> AttributeError: 'module' object has no attribute 'QVTKWidget2'
>>>>>
>>>>>
>>>>>
>>>>> VTK6.0.0> ls Wrapping/Python/vtk/qt4
>>>>> QVTKRenderWindowInteractor.pyc QVTKRenderWindowInteractor.py
>>>>> __init__.pyc __init__.py
>>>>>
>>>>>
>>>>>
>>>>> Here's how I'm compiling VTK:
>>>>>
>>>>> $(CMAKE) -DVTK_WRAP_PYTHON:BOOL=ON
>>>>> -DPYTHON_EXECUTABLE:FILEPATH=$(PYTHON)/bin/python
>>>>> -DPYTHON_INCLUDE_DIR:PATH=$(PYTHON)/include/python2.7
>>>>> -DPYTHON_LIBRARY:FILEPATH=$(PYTHON)/lib/libpython2.7.dylib
>>>>> -DQT_QMAKE_EXECUTABLE:FILEPATH=$(QMAKE) -DModule_vtkGUISupportQt:BOOL=ON
>>>>> -DModule_vtkGUISupportQtOpenGL:BOOL=ON
>>>>>
>>>>>
>>>>> is there an option I'm missing? Or is this something that will be fixed in
>>>>> the next version of VTK? (when will that be?)
>>>>>
>>>>> Thanks!
>>>>> Amos.
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131129/534a296b/attachment.htm>
More information about the vtkusers
mailing list