ParaView Trame Components
This project gather helper classes that can be used with ParaView to create quickly and simply web solution for interacting with your data.
Usage example
The ./examples/ directory gather simple Python scripts using ParaView and exposing them as standalone trame applications.
Virtual Environment setup
Since ParaView does not come with trame, you need to create a virtual environment that brings all the missing dependency for paraview to use.
# Create and activate venv
python3.10 -m venv .venv
source .venv/bin/activate
# Install published package
pip install paraview-trame-components
# Let ParaView know about the location of that venv
export PV_VENV=$PWD/.venv
Running examples
# Adjust path to point to your ParaView executable
export PVPYTHON=/Applications/ParaView-5.12.0.app/Contents/bin/pvpython
# Run the scripts
$PVPYTHON --force-offscreen-rendering ./examples/cone.py
$PVPYTHON --force-offscreen-rendering ./examples/cone-with-slider.py
$PVPYTHON --force-offscreen-rendering ./examples/wavelet-contour-state.py
$PVPYTHON --force-offscreen-rendering ./examples/pipeline.py
$PVPYTHON --force-offscreen-rendering ./examples/selection.py
Scripts structure
Each script add import paraview.web.venv at the top to enable your virtual environment via the PV_VENV environment variable.
Then we use the ptc (ParaView Trame Components) package to quickly create a trame application to view the data.
The wavelet-contour-state.py script was created by ParaView when saving its state as a Python file. Then we added few lines at the end to create an interactive web viewer.
Check code
# one time
pip install ".[dev]"
pre-commit install
# check but automatic on commit
pre-commit run --all-files
ParaView code example
import paraview.web.venv
from ptc import Viewer
from paraview import simple
cone = simple.Cone()
simple.Show()
simple.Render()
# Make it a web app
web_app = Viewer()
web_app.start()
And if you want to add some UI
import paraview.web.venv
from paraview import simple
from ptc import Viewer
from trame.widgets.vuetify3 import VSlider
cone = simple.Cone()
simple.Show()
simple.Render()
# Make it a web app
web_app = Viewer()
with web_app.side_top:
VSlider(
v_model=("resolution", 6),
min=3, max=60, step=1,
)
@web_app.state.change("resolution")
def on_resolution_change(resolution, **kwargs):
cone.Resolution = resolution
web_app.update()
web_app.start()
Example in image
| Write some python code | And get a web app |
Release files for paraview-trame-components 0.17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| paraview_trame_components-0.17.0.tar.gz | 38.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| paraview_trame_components-0.17.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 84.8 kB
Release files / paraview_trame_components-0.17.0.tar.gz
| Download URL | paraview_trame_components-0.17.0.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5044b0e7a17a9daf71f0c69165c884f7541d3f77b199b05b1db3fb92ae5c87d9
|
|
BLAKE2b-256 checksum How to use checksums |
890e01742582e4d55e3fd60a4472307867639d2cf143045df222d19a947c1c0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / paraview_trame_components-0.17.0-py3-none-any.whl
| Download URL | paraview_trame_components-0.17.0-py3-none-any.whl |
|---|---|
| Size | 46.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3566de41992cfbcb9eb96ad631d3b17e5113396cc5b3687a65b29029cc4b8b4a
|
|
BLAKE2b-256 checksum How to use checksums |
f2ca1ae731de4da33d3bce1ed58811348f457156fb17a7b7992fd4a9563008c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|