2

I'm using a Keybinder in a Gtk+3 application, but it doesn't get any key combinations. Here's the code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import gi
gi.require_version('Keybinder', '3.0')
from gi.repository import Keybinder
from gi.repository import Gtk


def test_func(data):
    print data


if __name__ == '__main__':
    wnd = Gtk.Window()
    wnd.connect('delete-event', Gtk.main_quit)
    wnd.show_all()

    if not Keybinder.bind('<Super>q', test_func, 'Hi there!'):
        print "Keybinder.bind() failed."

    Gtk.main()

I expect the program to execute test_func when I press Windows+q key combo, but it just does nothing. I'm running it on Debian Jessie with xfce4 if it makes a difference.

user2772570
  • 25
  • 1
  • 3

1 Answers1

2

As you're using the GIR-based Python bindings, I'm pretty sure you need to call

Keybinder.init()

manually before calling any other functions from the Keybinder library.

(From what I can tell, the static python-keybinder Python bindings do this for you, but the introspected bindings do not.)

Tristan Brindle
  • 16,281
  • 4
  • 39
  • 82