MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / add_callback

Method add_callback

lib/matplotlib/artist.py:404–431  ·  view source on GitHub ↗

Add a callback function that will be called whenever one of the `.Artist`'s properties changes. Parameters ---------- func : callable The callback function. It must have the signature:: def func(artist: Artist) -> Any

(self, func)

Source from the content-addressed store, hash-verified

402 return bbox
403
404 def add_callback(self, func):
405 """
406 Add a callback function that will be called whenever one of the
407 `.Artist`'s properties changes.
408
409 Parameters
410 ----------
411 func : callable
412 The callback function. It must have the signature::
413
414 def func(artist: Artist) -> Any
415
416 where *artist* is the calling `.Artist`. Return values may exist
417 but are ignored.
418
419 Returns
420 -------
421 int
422 The observer id associated with the callback. This id can be
423 used for removing the callback with `.remove_callback` later.
424
425 See Also
426 --------
427 remove_callback
428 """
429 # Wrapping func in a lambda ensures it can be connected multiple times
430 # and never gets weakref-gc'ed.
431 return self._callbacks.connect("pchanged", lambda: func(self))
432
433 def remove_callback(self, oid):
434 """

Callers 11

test_callbacksFunction · 0.95
__init__Method · 0.45
_single_shot_timerMethod · 0.45
_test_interactive_implFunction · 0.45
__call__Method · 0.45
__init__Method · 0.45
timers.pyFile · 0.45
__init__Method · 0.45
start_animFunction · 0.45

Calls 2

funcFunction · 0.50
connectMethod · 0.45

Tested by 4

test_callbacksFunction · 0.76
_test_interactive_implFunction · 0.36