vispy.app.timer module

class vispy.app.timer.Timer(interval='auto', connect=None, iterations=- 1, start=False, app=None)

Bases: object

Timer used to schedule events in the future or on a repeating schedule.

Parameters
intervalfloat | ‘auto’

Time between events in seconds. The default is ‘auto’, which attempts to find the interval that matches the refresh rate of the current monitor. Currently this is simply 1/60.

connectfunction | None

The function to call.

iterationsint

Number of iterations. Can be -1 for infinite.

startbool

Whether to start the timer.

appinstance of vispy.app.Application

The application to attach the timer to.

property app

Timer is based on this vispy Application instance.

connect(callback)

Alias for self.events.timeout.connect().

disconnect(callback=None)

Alias for self.events.timeout.disconnect().

property elapsed
property interval
property native

Timer is based on this native timer

property running
start(interval=None, iterations=None)

Start the timer.

A timeout event will be generated every interval seconds. If interval is None, then self.interval will be used.

If iterations is specified, the timer will stop after emitting that number of events. If unspecified, then the previous value of self.iterations will be used. If the value is negative, then the timer will continue running until stop() is called.

If the timer is already running when this function is called, nothing happens (timer continues running as it did previously, without changing the interval, number of iterations, or emitting a timer start event).

stop()

Stop the timer.