pythonpython-2.7python-idleparaview

Controlling Paraview GUI from Python IDLE


I am trying to control Paraview interactively using IDLE. This would involve sending commands from IDLE and seeing the changes occur in Paraview. I would rather not use the in-Paraview python shell.

So far, I have succeeded in importing the Paraview modules (simple, servermanager…etc) from IDLE. However the commands sent do not reflect in Paraview. For instance:

>>> from paraview.simple import *
>>> cone = Cone()
>>> Show()
>>> Render()

does indeed create a cone. However the cone is output to a new, independent OpenGL window, and not the Paraview GUI.

Is it possible to control Paraview interactively using IDLE? If so how to accomplish this? Thanks


Solution

  • You need to run paraview in multiclient/server mode. In a terminal run pvserver.

    ./bin/pvserver --multi-clients
    

    In another terminal, run paraview and connect to your server

    ./bin/paraview
    File->Connect
    AddServer -> Choose a name -> Configure -> Save
    Connect
    

    In a third terminal, run pvpython (or your own configured python)

    ./bin/pvpython
    >> from paraview.simple import *
    >> Connect("localhost")
    >> Cone()
    >> Show()