Vizard 7 » Command Index » Vizard modules » viz » <viz>.elapsed
7.6

<viz>.elapsed

Returns the elapsed time of the current timer

<viz>.elapsed()  

Remarks

This command should only be used inside a timer callback. When this command is called inside a timer callback it returns the time the timer has been waiting to expire.

Return Value

The elapsed time in seconds

Example

#The code below should print out:
#Elapsed time: 2.4 seconds

def mytimer(num):
    print('Elapsed time: {:.1f} seconds'.format(viz.elapsed()))

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,2.4)

See also

<viz>.callback
<viz>.starttimer
<viz>.killtimer
<viz>.play
<viz>.pause