multiwindows2.py 869 B

1234567891011121314151617181920212223242526
  1. """Multiple plotter sync-ed windows"""
  2. from vedo import Ellipsoid, Cone, Cylinder, show
  3. acts = [Ellipsoid().color('Bisque'),
  4. Cone().color('RosyBrown'),
  5. Cylinder().color('Chocolate'),
  6. ]
  7. opts = dict(axes=1, interactive=False, new=True, size=(390,390))
  8. ts = [f"Window nr.{i}" for i in range(4)]
  9. plt0 = show(acts[0], **opts, pos=( 200,0), title=ts[0], viewup='z')
  10. plt1 = show(acts[1], **opts, pos=( 600,0), title=ts[1], camera=plt0.camera)
  11. plt2 = show(acts[2], __doc__, **opts, pos=(1000,0), title=ts[2], camera=plt0.camera)
  12. plts = [plt0, plt1, plt2]
  13. def func(evt):
  14. for i in range(3):
  15. if ts[i] != evt.title: # only update the other windows
  16. plts[i].render()
  17. for plt in plts:
  18. plt.add_callback('Interaction', func)
  19. plt.add_callback('EndInteraction', func) # because zooming is not an "Interaction" event
  20. plt.interactive()