class Task

A Task enables you to schedule code to be executed after a specified period of time, either once or repeatedly.

Tasks are intended for applications in which accuracy of timing is not critical. Tasks are synchronised with the event loop, so if your application is busy processing an event when a Task becomes ready to execute, it will be delayed until processing of the event as finished. Also, on some platforms, Tasks might not run while a menu is being pulled down or other controls are being interacted with.

Constructor

Task(proc, interval, repeat = False, start = True)
Creates a task which will execute the proc after interval seconds. If repeat is true, the task will continue to fire repeatedly every interval seconds, otherwise it will fire only once and then stop. If start is true, the task's timer will be started immediately, otherwise the task will remain dormant until it is activated using the start() method.

Arbitrary fractions of a second may be specified for interval, although granularity of timing is platform-dependent.

Properties

scheduled
Read only Returns true if the task has been scheduled to run by calling the start() method or passing true to the start parameter of the constructor.

Methods

start()
Schedules the task for execution and starts its timer. If the task was already scheduled, or was previously unscheduled using stop() part way through a timing period, the time period is started anew.

stop()
Stops the task's timer and unschedules it. The task will remain dormant until start() is called again.

--