Yes, you can define your own key and mouse button handlers in python. Check out some example code here:
http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/GUI/Python/CustomInteraction.py Pat On Tue, Nov 1, 2011 at 5:25 PM, Cheng Zhang <cheng...@engineering.uiowa.edu>wrote: > Hi Pat, > > That example you showed is awesome. Can I also add keyboard interaction > with the render window? > > On Tue, Nov 1, 2011 at 3:52 PM, pat marion <pat.mar...@kitware.com> wrote: > >> Actually, if you follow the steps from this email, you can interact with >> the render window from pvpython: >> >> >> http://markmail.org/message/sjt6pbkyc56l2wgl >> >> >> Pat >> >> On Tue, Nov 1, 2011 at 10:24 AM, Utkarsh Ayachit < >> utkarsh.ayac...@kitware.com> wrote: >> >>> pvpython cannot be used for interactive viz (generally), it mostly >>> designed for batch. So it executes the script and then quits. Try adding a >>> >>> raw_input() >>> >>> at the end and the script will pause for input before exiting, giving >>> you an opportunity to look at the rendered result. Generally you'd edit the >>> script to add WriteImage() or somethign similar to generate screenshots or >>> save processed data out. >>> >>> If you want to use it in an interactive fashion, you should stick with >>> Python Shell in the GUI. >>> >>> Utkarsh >>> >>> >>> >>> On Tue, Nov 1, 2011 at 10:13 AM, David Dupuis < >>> david.dup...@cadensimaging.com> wrote: >>> >>>> Sta.py is a Python state file I have created using “Save state” in the >>>> GUI. Yes, it needs to open the GUI and load the whole pipeline saved in the >>>> Python State file. >>>> >>>> >>>> >>>> *De :* Adriano Gagliardi [mailto:agaglia...@ara.co.uk] >>>> *Envoyé :* 1 novembre 2011 10:07 >>>> *À :* 'David Dupuis'; 'Utkarsh Ayachit' >>>> *Cc :* paraview@paraview.org >>>> *Objet :* RE: [Paraview] Paraview Python scripting >>>> >>>> >>>> >>>> What does sta.py do that it needs to open the GUI? Do you mean an X11 >>>> window? >>>> >>>> >>>> >>>> =================================== >>>> >>>> Adriano Gagliardi MEng PhD >>>> Business Sector Leader >>>> Computational Aerodynamics >>>> Aircraft Research Association Ltd. >>>> Manton Lane >>>> Bedford >>>> >>>> Tel: 01234 32 4644 >>>> E-mail: agaglia...@ara.co.uk >>>> Url: www.ara.co.uk >>>> >>>> >>>> >>>> >>>> ------------------------------ >>>> >>>> *From:* paraview-boun...@paraview.org [mailto: >>>> paraview-boun...@paraview.org] *On Behalf Of *David Dupuis >>>> *Sent:* 01 November 2011 14:00 >>>> *To:* Utkarsh Ayachit >>>> *Cc:* paraview@paraview.org >>>> *Subject:* Re: [Paraview] Paraview Python scripting >>>> >>>> Hello Utkarsh, >>>> >>>> >>>> >>>> The Python Shell works fine. >>>> >>>> >>>> >>>> On the other hand, if you mean using pvpython this way: >>>> >>>> >>>> >>>> >> /home/david/ParaView-3.12.0-RC2-Linux-x86_64/bin/pvpython ./sta.py >>>> >>>> >>>> >>>> It doesn’t work... The GUI will flash (open partially and shutdown >>>> quickly) and we cannot see anything... >>>> >>>> >>>> >>>> Thanks again! >>>> >>>> David >>>> >>>> >>>> >>>> *De :* Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com] >>>> *Envoyé :* 1 novembre 2011 09:35 >>>> *À :* David Dupuis >>>> *Cc :* paraview@paraview.org >>>> *Objet :* Re: [Paraview] Paraview Python scripting >>>> >>>> >>>> >>>> Have you tried using the pvpython executable? It's sets up the >>>> environment correctly for you. Alternatively, from the GUI, you can open >>>> the Python Shell and and then use the "Load Script" button to load the >>>> script. >>>> >>>> >>>> >>>> Utkarsh >>>> >>>> On Tue, Nov 1, 2011 at 9:28 AM, David Dupuis < >>>> david.dup...@cadensimaging.com> wrote: >>>> >>>> Hello, >>>> >>>> >>>> >>>> I’m manipulating different dataset and for each of them I have a >>>> different setup (pipeline). I saved the state as a python file and plan to >>>> re-use the python state file to re-open the whole pipeline for each >>>> dataset. It seems that only *.psvm files can be loaded via File -> Load >>>> state in Paraview. Is there a way to load a python state file? >>>> >>>> >>>> >>>> Here is what I tried to do so, but didn’t succeeded. >>>> >>>> >>>> >>>> 1- I followed the procedure for Paraview/Python scripting, and added >>>> PYTHONPATH in .bashrc: >>>> >>>> export >>>> PYTHONPATH="/home/david/ParaView-3.12.0-RC2-Linux-x86_64/lib/paraview-3.12/site-packages/:/home/david/ParaView-3.12.0-RC2-Linux-x86_64/bin" >>>> >>>> >>>> >>>> * The only thing I can’t do is adding the path to >>>> ="/home/david/ParaView-3.12.0-RC2-Linux-x86_64/Utilities/VTKPythonWrapping/site-packages >>>> since I don’t have any Utilities folder in my Paraview directory. I believe >>>> this is required, but don’t know what to install and where to get it to >>>> have it... >>>> >>>> >>>> >>>> 2- I tried to load the python state file via python with the setup >>>> described at step 1, but got the following error: >>>> >>>> >>>> >>>> >> python ./sta.py >>>> >>>> Traceback (most recent call last): >>>> >>>> File "/home/david/CADv2/Patients/P1/Prone/sta.py", line 2, in <module> >>>> >>>> except: from paraview.simple import * >>>> >>>> File >>>> "/home/david/ParaView-3.12.0-RC2-Linux-x86_64/lib/paraview-3.12/site-packages/paraview/simple.py", >>>> line 39, in <module> >>>> >>>> import servermanager >>>> >>>> File >>>> "/home/david/ParaView-3.12.0-RC2-Linux-x86_64/lib/paraview-3.12/site-packages/paraview/servermanager.py", >>>> line 43, in <module> >>>> >>>> import paraview, re, os, os.path, new, sys, vtk >>>> >>>> File >>>> "/home/david/ParaView-3.12.0-RC2-Linux-x86_64/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", >>>> line 1, in <module> >>>> >>>> from vtkCommonPython import * >>>> >>>> ImportError: No module named vtkCommonPython >>>> >>>> >>>> >>>> I have taken a look and there is no vtkCommonPython module on my >>>> machine. Is it part of the VTKPythonWrapping in Utilities? >>>> >>>> >>>> >>>> Thanks for helping me with this one. >>>> >>>> David >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> [image: L_CadensImaging+rendering_C_gif] >>>> >>>> >>>> >>>> DAVID DUPUIS >>>> >>>> Chef de produit | Product manager >>>> >>>> >>>> >>>> 116 principale, suite 200 >>>> >>>> Granby (Qubec), J2G 2V2 >>>> >>>> CANADA >>>> >>>> >>>> >>>> T: 450.956.3456 I Ext: 5114 >>>> >>>> F: 450.991.3456 >>>> >>>> david.dup...@cadensimaging.com >>>> >>>> >>>> >>>> *Avis :* Ce message est confidentiel et est à l'usage exclusif de son >>>> destinataire. Il est strictement interdit à toute autre personne de le >>>> diffuser, le distribuer ou le reproduire. Si le destinataire ne peut être >>>> joint ou vous est inconnu, veuillez informer l'expéditeur par courrier >>>> électronique immédiatement et effacer ce message et en détruire toute >>>> copie. Les communications par Internet sont exposées au risque d'altération >>>> des données, d'autres erreurs de transmission et la perte de >>>> confidentialité. Si vous désirez que nous communiquions avec vous par un >>>> autre moyen, veuillez nous en aviser. >>>> >>>> >>>> >>>> *Notice:* This message is confidential and is intended for the >>>> exclusive use of the addressee. Any other person is strictly prohibited >>>> from disclosing, distributing or reproducing it. If the addressee cannot >>>> be reached or is unknown to you, please inform the sender by return e-mail >>>> immediately and delete this message and destroy all copies. Internet >>>> communications are subject to the risk of data corruption, other >>>> transmission errors and loss of confidentiality. Please advise if you wish >>>> us to use a different method when communicating with you. >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> 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 ParaView Wiki at: >>>> http://paraview.org/Wiki/ParaView >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> http://www.paraview.org/mailman/listinfo/paraview >>>> >>>> >>>> >>>> ********************************************************************** >>>> This email contains information that is private and confidential and is >>>> intended only for the addressee. >>>> If you are not the intended recipient please delete it and notify us >>>> immediately by e-mailing the sender. >>>> Note: All email sent to or from this address may be accessed by someone >>>> other than the recipient, for >>>> system management and security reasons. >>>> Aircraft Research Association Ltd. Registered in England, Registration >>>> No 503668 Registered Office: >>>> Manton Lane, Bedford MK41 7PF England VAT No GB 196351245 >>>> >>>> ********************************************************************** >>>> >>> >>> >>> _______________________________________________ >>> 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 ParaView Wiki at: >>> http://paraview.org/Wiki/ParaView >>> >>> Follow this link to subscribe/unsubscribe: >>> http://www.paraview.org/mailman/listinfo/paraview >>> >>> >> >> _______________________________________________ >> 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 ParaView Wiki at: >> http://paraview.org/Wiki/ParaView >> >> Follow this link to subscribe/unsubscribe: >> http://www.paraview.org/mailman/listinfo/paraview >> >> > > > -- > Cheng Zhang > > PhD Candidate > The Department of Electrical and Computer Engineering > The University of Iowa, USA >
_______________________________________________ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview