Question

def activate(self,shell):
        self.shell = shell
        self.action = gtk.Action ('foo','bar','baz',None)
        self.activate_id = self.action.connect ('activate', self.call_bk_fn,self.shell)
        self.action_group = gtk.ActionGroup ('hot_key_action_group')
        self.action_group.add_action_with_accel (self.action, "<control>E")

        uim = shell.get_ui_manager ()
        uim.insert_action_group (self.action_group, 0)
        uim.ensure_update ()
def call_bk_fn(self,shell):
                print('hello world')

i am using the above code in a plugin for rhythmbox ,and here i am trying to register the key ctr+e so that the call_bk_fn gets called whenever the key combination is pressed , but its not working why is that so ?

Was it helpful?

Solution

One thing that i did remark is that your callback should be like this:

def call_bk_fn(self, event, shell):
    print('hello world')

hope this can help :), if you still have some problem i think you should give us more info about the errors that are raised .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top