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

Method connect

lib/matplotlib/cbook.py:300–310  ·  view source on GitHub ↗

Register *func* to be called when signal *signal* is generated.

(self, signal, func)

Source from the content-addressed store, hash-verified

298 self._cid_gen = itertools.count(cid_count)
299
300 def connect(self, signal, func):
301 """Register *func* to be called when signal *signal* is generated."""
302 if self._signals is not None:
303 _api.check_in_list(self._signals, signal=signal)
304 proxy = _weak_or_strong_ref(func, functools.partial(self._remove_proxy, signal))
305 try:
306 return self._func_cid_map[signal, proxy]
307 except KeyError:
308 cid = self._func_cid_map[signal, proxy] = next(self._cid_gen)
309 self.callbacks.setdefault(signal, {})[cid] = proxy
310 return cid
311
312 def _connect_picklable(self, signal, func):
313 """

Calls 1

_weak_or_strong_refFunction · 0.85