Open topic with navigation
<vizact>.ontimer2
Perform an action on a certain time interval a certain amount of times
<vizact>.ontimer2( |
|
rate |
repeats |
func |
*args |
) |
|
rate
The rate at which to call the function (in seconds)
repeats
Number of times to repeat the timer. If 0, the timer will be called only once. If 1, the timer will be called twice. IF viz.FOREVER, timer will repeat indefinitely.
func
The function to call when the timer expires
*args
The arguments to be passed to func.
Remarks
This will call the specified function with the specified arguments on the specified interval. The timer will repeat as many times as specified.
Return Value
A
vizact.EventFunction object with the following methods:
<event>.setEnabled(val) | Enable/Disable the event function. The associated function will not be called while the event function is disabled. viz.TOGGLE can be used to toggle the state. Event functions are initially enabled. |
<event>.getEnabled() | Get the enabled state of the event function. |
<event>.remove() | Permanently unregister the event function. |
Example
def dostuff2():
print('3- 3 second intervals')
vizact.ontimer2(3,3,dostuff2)
See also