GNOME Bugzilla – Bug 752784
Gdk.EventKey.is_modifier is always 0
Last modified: 2016-03-03 07:55:54 UTC
As the summary says. Im using the latest arch package 3.16. Simple test case (just press a modifier): from gi.repository import Gtk def onKeyPress(wid, ev): print(ev.is_modifier) win = Gtk.Window() win.connect("delete_event", Gtk.main_quit) win.connect("key_press_event", onKeyPress) win.show_all() Gtk.main()
I just installed from git. The bug is there too.
The "is_modifier" field is a bit of a misnomer, please read through [1]. What you want is the "state" field: def onKeyPress(wid, ev): print(ev.state & Gdk.ModifierType.SHIFT_MASK) [1] https://lazka.github.io/pgi-docs/#Gdk-3.0/structs/EventKey.html