Here is the code that finally worked. As it depends highly on my development environment Quickly + Glade + Python + Gtk, I make it an independent answer. Bryce's answer helped a lot, and so did my exchanges with aking1012.
The actual code, in a text editor:
# Accelerators
self.my_accelerators = Gtk.AccelGroup()
self.window = self.builder.get_object("discvur_window")
self.window.add_accel_group(self.my_accelerators)
self.entry = self.builder.get_object("entry1")
self.add_accelerator(self.entry, "<Control>b", signal="backspace")
…
def add_accelerator(self, widget, accelerator, signal="activate"):
"""Adds a keyboard shortcut"""
if accelerator is not None:
#if DEBUG:
#print accelerator, widget.get_tooltip_text()
key, mod = Gtk.accelerator_parse(accelerator)
widget.add_accelerator(signal, self.my_accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
print "The accelerator is well added with the signal " + signal
def on_erasing(self, widget):
print "It works."
In Glade, I created a GtkEntry called "entry1" in my window called "discvur_window". In
the 'Signals' tab, I gave the signal "backspace" a handler called "on_erasing".
Now, hitting Backspace or Ctrl+B makes the terminal print "It works.".