anyplotlib.CallbackRegistry#

class anyplotlib.CallbackRegistry[source]#

Bases: object

Per-object handler store.

Supports: - Priority ordering (order kwarg — lower fires first) - Wildcard "*" type receives every dispatched event - stop_propagation on the event halts remaining handlers - disconnect_fn(fn, *types) removes by callback reference - pause_events / hold_events context managers (added in Task 3)

connect(event_type, fn, *, order=0)[source]#

Register fn for event_type. Returns integer CID.

Parameters:
Return type:

int

disconnect(cid)[source]#

Remove handler by CID. Silent if not found.

Parameters:

cid (int)

Return type:

None

disconnect_fn(fn, *types)[source]#

Remove fn from the given types (all types if none given).

Parameters:
Return type:

None

fire(event)[source]#

Dispatch event to matching handlers (respects pause/hold).

Parameters:

event (Event)

Return type:

None

pause_events(*types)[source]#

Suppress events of the given types while inside this context. All types are paused when called with no arguments. Pause wins over hold for the same type.

Parameters:

types (str)

hold_events(*types)[source]#

Buffer events of the given types; flush when the outermost hold exits. All types are held when called with no arguments.

Parameters:

types (str)