timer_callback0.py 391 B

123456789101112131415161718
  1. from vedo import *
  2. from time import time
  3. def loop_func(event):
  4. msh.rotate_z(0.1)
  5. txt.text(f"time: {event.time - t0} sec")
  6. plt.render()
  7. t0 = time()
  8. msh = Cube()
  9. txt = Text2D(bg='yellow', font="Calco")
  10. plt = Plotter(axes=1)
  11. # plt.initialize_interactor() # on windows this is needed
  12. plt.add_callback("timer", loop_func)
  13. plt.timer_callback("start")
  14. plt.show(msh, txt)
  15. plt.close()