Poll#

ignis.utils.Utils.Poll(timeout: int, callback: Callable, *args)#

Call a callback every n milliseconds specefied by the timeout.

Properties:
  • timeout (int, required, read-write): The timeout interval in milliseconds.

  • callback (Callable, required, read-write): The function to call when the timeout is reached. The self will passed as an argument.

  • output (str, not argument, read-only): The output of the callback.

You can pass arguments to the constructor, and they will be passed to the callback.

Hint

You can use bind() on output.

Example usage:

from ignis.utils import Utils

# print "Hello" every second
Utils.Poll(timeout=1, callback=lambda self: print("Hello"))