MCPcopy Create free account
hub / github.com/ActiveState/code / global_bind

Function global_bind

recipes/Python/580795_bind_all_tkinter_bug/recipe-580795.py:26–38  ·  view source on GitHub ↗
(w, event, func, add=None)

Source from the content-addressed store, hash-verified

24
25
26def global_bind(w, event, func, add=None):
27 root = w.nametowidget(".")
28
29 handlers_of_event = _handlers[event]
30 if len(handlers_of_event) == 0:
31 root.bind_all(event, functools.partial(_run_handlers, handlers_of_event))
32
33 if add == "+":
34 handlers_of_event.append(func)
35 else:
36 handlers_of_event[:] = [func]
37
38 return func
39
40def global_unbind(w, event, func):
41 handlers_of_event = _handlers[event]

Callers 1

recipe-580795.pyFile · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected