Interacting with views in ParaView Python (pvpython)

February 3, 2015

We recently added new functionality to ParaView to support interacting with the view when using pvpython. This is supported as of nightly version (v4.3.1-122-g1a5724d) and will included in the next stable release (version 4.4). Previously, users could not interact with any Render View, or Bar Chart View etc., when running pvpython or pvbatch. While it still doesn't make sense to support interaction when using pvbatch, one can finally interact with these views in pvpython. Here's how:

from paraview.simple import *

Wavelet()
Show()
Render()
Interact()

The only thing new is the Interact(view) function. You can optionally pass it an argument which is the view to interact with. In none is provided, the active view will be used. This method will block to allow you to interact with the view window with all the interaction modifier available in the GUI. To stop interaction and return to the shell press the q (or Q) key.

Calling Interact in pvbatch script, however, will have no effect and it will return immediately. Same is the case with scripts run in the Python Shell in the ParaView GUI.

Another example:

# Interacting with Line Plot View.
from paraview.simple import *

Wavelet()
UpdatePipeline()
PlotOverLine()
Show()
Render()
Interact()

Known issues


  1. On OsX the q (or Q) doesn't seem to work as expected. We'll have a fix soon.

2 comments to Interacting with views in ParaView Python (pvpython)

Leave a Reply to Guojin FengCancel reply