(self, callback, key_binding)
Binds a key combination to a callback.

    Args:
      callback: An argument-less callable.
      key_binding: A integer with a key code, a tuple (keycode, modifier) or one
        of the actions Exclusive|DoubleClick|Range carrying the key combination.
Binds a key combination to a callback.
Binds a key combination to a callback .
def bind(self, callback, key_binding):
    """Binds a key combination to a callback.

    Args:
      callback: An argument-less callable.
      key_binding: A integer with a key code, a tuple (keycode, modifier) or one
        of the actions Exclusive|DoubleClick|Range carrying the key combination.
    """
    def build_callback(index, callback):
      def indexed_callback():
        callback(index)
      return indexed_callback

    if isinstance(key_binding, Range):
      for index, binding in enumerate(key_binding.collection):
        self._add_binding(build_callback(index, callback), binding)
    else:
      self._add_binding(callback, key_binding)
def bind ( self , callback , key_binding ) : def build_callback ( index , callback ) : def indexed_callback ( ) : callback ( index ) return indexed_callback if isinstance ( key_binding , Range ) : for index , binding in enumerate ( key_binding . collection ) : self . _add_binding ( build_callback ( index , callback ) , binding ) else : self . _add_binding ( callback , key_binding )