(w, event, func, add=None)
| 24 | |
| 25 | |
| 26 | def 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 | |
| 40 | def global_unbind(w, event, func): |
| 41 | handlers_of_event = _handlers[event] |