slider_browser.py 981 B

12345678910111213141516171819202122232425262728293031323334
  1. """Mouse hind limb growth from day 10 9h to day 15 21h"""
  2. from vedo import settings, dataurl, Assembly
  3. from vedo import Text2D, Plotter, Image, Axes, Line
  4. def sliderfunc(widget, event):
  5. i = int(widget.value)
  6. days = int((i * 2 + 249) / 24)
  7. widget.title = f"{days}d {i*2+249-days*24}h"
  8. # remove the old and add the new shape
  9. # (no need to render as the slider makes a call to rendering)
  10. plt.pop().add(objs[i])
  11. objs = Assembly(dataurl+"timecourse1d.npy") # load a list of shapes
  12. settings.default_font = "Glasgo"
  13. plt = Plotter(bg="blackboard")
  14. plt += Text2D(__doc__, pos="top-center", s=1.2).color("w")
  15. plt += Image(dataurl + "images/limbs_tc.jpg").scale(0.0154).y(10)
  16. plt += Line([(0, 8), (0, 10), (28.6, 10), (4.5, 8)]).color("gray")
  17. plt += Axes(objs[-1])
  18. plt += objs[0]
  19. plt.add_slider(
  20. sliderfunc,
  21. 0,
  22. len(objs) - 1,
  23. pos=[(0.4, 0.1), (0.9, 0.1)],
  24. show_value=False,
  25. title_size=1.5,
  26. )
  27. plt.show(zoom=1.2, mode="image")
  28. plt.close()