class documentation

class DelayedCallback(object): (source)

View In Hierarchy

Wrapper for callbacks that need to be delayed after a signal

This class allows you to add a callback to a signal, but only have it called after a certain timeout. If the signal is emitted again during this time the callback will be canceled and the timeout starts again. (So the callback is not called for each repeat of the signal.) This can be used e.g. in case want to update some other widget after the user changes a text entry widget, but this can be done once the user pauses, while calling the callback for every key stroke would make the application non-responsive.

Objects of this class wrap the actual callback function and can be called as a normal function.

Note that when a repeated callback is canceled, only the arguments of the last call are passed on.

Unknown Field: todo
allow an option to check arguments and pass on all unique combinations ?
add support for async callbacks, in this case block the callback until the async process is finished
Method __call__ Undocumented
Method __del__ Undocumented
Method __init__ Constructor
Method cancel Cancel the scheduled callback
Class Variable __slots__ Undocumented
Instance Variable cb_func Undocumented
Instance Variable timeout Undocumented
Instance Variable timer_id Undocumented
def __call__(self, *arg, **kwarg): (source)

Undocumented

def __del__(self): (source)

Undocumented

def __init__(self, timeout, cb_func): (source)
Constructor
Parameters
timeouttimeout in milliseconds (e.g. 500)
cb_functhe callback to call
def cancel(self): (source)
Cancel the scheduled callback
__slots__: tuple[str, ...] = (source)

Undocumented

cb_func = (source)

Undocumented

timeout = (source)

Undocumented

timer_id = (source)

Undocumented