File: timer_callback0.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 391 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from vedo import *
from time import time

def loop_func(event):
    msh.rotate_z(0.1)
    txt.text(f"time: {event.time - t0} sec")
    plt.render()

t0 = time()
msh = Cube()
txt = Text2D(bg='yellow', font="Calco")

plt = Plotter(axes=1)
# plt.initialize_interactor() # on windows this is needed
plt.add_callback("timer", loop_func)
plt.timer_callback("start")
plt.show(msh, txt)
plt.close()