efl.ecore.Timer Class

class efl.ecore.Timer(double interval, func, *args, **kargs)

Bases: efl.eo.Eo

This class represents a timer that will call the given func every interval seconds. The function will be passed any extra parameters given to constructor.

When the timer func is called, it must return a value of either True or False (remember that Python returns None if no value is explicitly returned and None evaluates to False). If it returns True, it will be called again at the next interval, or if it returns False it will be deleted automatically making any references/handles for it invalid.

Timers should be stopped/deleted by means of delete() or returning False from func, otherwise they’ll continue alive, even if the current python context delete it’s reference to it.

Parameters:
  • interval (float) – interval in seconds.
  • func (callable) – function to callback when timer expires.
  • *args – All the remaining arguments will be passed back in the callback function.
  • **kwargs – All the remaining keyword arguments will be passed back in the callback function.

Expected func signature:

func(*args, **kargs): bool
delay(add)

Delay the execution of the timer by the given amount

Parameters:add (double) – seconds to add to the timer

New in version 1.8.

delete()

Stop callback emission and free internal resources.

freeze()

Pauses a running timer.

interval

The interval (in seconds) between each call of the timer

Type:double
interval_get()
interval_set(t)
pending

The pending time for the timer to expire

Type:double

New in version 1.8.

pending_get()
reset()

Reset the counter of the timer

New in version 1.8.

stop()

Alias for delete()

thaw()

Resumes a frozen (paused) timer.