Poll#

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

Calls a callback every n milliseconds specified by the timeout.

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

Parameters:
  • timeout (int) -- The timeout interval in milliseconds.

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

  • *args -- Arguments to pass to callback.

Example usage:

from ignis.utils import Utils

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

Emitted at each iteration.

gproperty timeout: int#
  • read-write

The timeout interval in milliseconds.

gproperty callback: Callable#
  • read-write

The function to call when the timeout is reached. The self will passed as an argument.

gproperty output: Any#
  • read-only

The output of the callback.

Hint

You can use bind() on output.

cancel() None#

Cancel polling.

Return type:

None