discussion_527.py 1016 B

123456789101112131415161718192021222324252627282930313233343536
  1. from vedo import *
  2. settings.immediate_rendering = False # faster for multi-renderers
  3. # (0,0) is the bottom-left corner of the window, (1,1) the top-right
  4. # the order in the list defines the priority when overlapping
  5. custom_shape = [
  6. dict(bottomleft=(0.0, 0.0), topright=(0.5, 1), bg="wheat", bg2="w"), # ren0
  7. dict(bottomleft=(0.5, 0.0), topright=(1, 1), bg="blue3", bg2="lb"), # ren1
  8. dict(bottomleft=(0.2, 0.05), topright=(0.8, 0.1), bg="white"), # ren2
  9. ]
  10. plt = Plotter(shape=custom_shape, size=(1600, 900))
  11. s0 = ParametricShape(0)
  12. s1 = ParametricShape(1)
  13. plt.at(0).add(s0, "renderer0")
  14. plt.at(1).add(s1, "renderer1")
  15. def slider1(widget, event):
  16. value = widget.value
  17. s0.rotate_y(value)
  18. s1.rotate_y(-value)
  19. opts = dict(
  20. slider_length=0.06,
  21. slider_width=0.6,
  22. end_cap_length=0.02,
  23. end_cap_width=0.5,
  24. tube_width=0.1,
  25. title_height=0.15,
  26. )
  27. plt.at(2).add_slider(slider1, -5, 5, value=0, pos=([0.05, 0.02], [0.55, 0.02]), **opts)
  28. plt.show(interactive=True).close()