Difference between revisions of "Dabo.ui.callAfterInterval"

From Dabo Wiki
Jump to: navigation, search
(Created page with "== Signature: == <syntaxhighlight lang="python"> dabo.ui.callAfterInterval(interval, func, *args, **kwargs) </syntaxhighlight> == Description: == This function serves two pu...")
(No difference)

Revision as of 14:18, 14 May 2020

Signature:

dabo.ui.callAfterInterval(interval, func, *args, **kwargs)

Description:

This function serves two purposes:

  • When you need for something to happen after a given delay
  • When you may get multiple calls to the same function within a given period, and you only want it to execute once.

Returns:

None

Comments:

The interval parameter is in milliseconds (e.g. 2000 = 2 seconds)

The first purpose listed above is simply a way to delay a function without having to go through the bother of creating and managing a timer. The framework handles that for you.

The second usage is a way to make sure that a function is only executed once in a given time period. For example, if you have several controls that could potentially send a message to a form to carry out a processor-intensive function in a tight loop, use callAfterInterval() with a reasonable interval to ensure that the expensive function is only executed once.