trame_ex1.py 952 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # See more examples at:
  4. # https://github.com/Kitware/trame-tutorial
  5. from trame.app import get_server
  6. from trame.ui.vuetify import SinglePageLayout
  7. from trame.widgets import vtk, vuetify
  8. import vedo
  9. sphere = vedo.Sphere().lw(1)
  10. sphere.cmap("Spectral_r", sphere.vertices[:, 1])
  11. axes = vedo.Axes(sphere)
  12. plt = vedo.Plotter()
  13. plt += sphere
  14. plt += axes.unpack()
  15. plt += vedo.Text3D("A color sphere", font='Quikhand', s=0.2, pos=[-1,1,-1])
  16. # -----------------------------------------------------------------------------
  17. # Trame
  18. # -----------------------------------------------------------------------------
  19. server = get_server()
  20. with SinglePageLayout(server) as layout:
  21. layout.title.set_text("Hello trame")
  22. with layout.content:
  23. with vuetify.VContainer(fluid=True, classes="pa-0 fill-height"):
  24. plt.reset_camera()
  25. view = vtk.VtkLocalView(plt.window)
  26. server.start()