File: 05_resource_loading.py

package info (click to toggle)
python-trame 3.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 101,620 kB
  • sloc: python: 13,515; sh: 183; javascript: 93; makefile: 7
file content (32 lines) | stat: -rw-r--r-- 1,094 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from trame.app import get_server
from trame.ui.html import DivLayout
from trame.widgets import html, trame, vtk

server = get_server()

# -----------------------------------------------------------------------------
# Web App setup
# -----------------------------------------------------------------------------

with DivLayout(server) as layout:
    container = layout.root
    trame.LifeCycleMonitor(events=("['created']",))
    container.style = "width: 100vw; height: 100vh;"
    with vtk.VtkView(ref="view"):
        with vtk.VtkGeometryRepresentation():
            vtk.VtkAlgorithm(vtk_class="vtkConeSource", state=("{ resolution }",))
    html.Input(
        type="range",
        min=3,
        max=60,
        step=1,
        v_model=("resolution", 6),
        style="position: absolute; top: 20px; left: 20px; z-index: 1; width: 25%; min-width: 300px;",
    )

# -----------------------------------------------------------------------------
# start server
# -----------------------------------------------------------------------------

if __name__ == "__main__":
    server.start()