I am in the process of creating my first Gtk3+ application using python, and I am quite frustrated with the lack of documentation :(
Well, what I'm trying to do is to configure the Delete button to remove an item from my TreeView
, and I don't have a remove button in order to bind the "clicked" signal of it for my code.
This is my code:
def make_shortcuts(self):
self.my_accelerators = Gtk.AccelGroup()
self.add_accel_group(self.my_accelerators)
self.add_accelerator(self.treeview, "<Delete>", signal="???")
def add_accelerator(self, widget, accelerator, signal="activate"):
if accelerator is not None:
key, mod = Gtk.accelerator_parse(accelerator)
widget.add_accelerator(signal, self.my_accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
I don't get how a keyboard shortcut must be binded to a signal and not to a function. Binding to a function is way more flexible.
Is there any way I can bind a keyboard shortcut to a function?