def do_grab(): event_mask = Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK v = Gdk.pointer_grab(window.get_window(), False, event_mask, None, None, 0) #Gdk.BUTTON_PRESS_MASK | Gdk.BUTTON_RELEASE_MASK | Gdk.KEY_PRESS_MASK \ #Gdk.KEY_RELEASE_MASK | Gdk.ENTER_NOTIFY_MASK) # | Gdk.ENTER_NOTIFY_MASK #Gdk.ALL_EVENTS_MASK action_label.set_text("pointer_grab() returned %s" % GRAB_STATUS_STRING.get(v, v)) GLib.timeout_add(10*1000, Gdk.pointer_ungrab, 0)
def ungrab_keyboard(*_args): v = Gdk.keyboard_ungrab(0) action_label.set_text("keyboard_ungrab(0)=%s" % GRAB_STATUS_STRING.get(v, v))
def grab_keyboard(*_args): v = Gdk.keyboard_grab(window.get_window(), True, 0) action_label.set_text("keyboard_grab(..)=%s" % GRAB_STATUS_STRING.get(v, v)) GLib.timeout_add(10 * 1000, Gdk.keyboard_ungrab, 0)
def ungrab_pointer(*_args): v = Gdk.pointer_ungrab(0) action_label.set_text("pointer_ungrab(0)=%s" % GRAB_STATUS_STRING.get(v, v)) window.unmaximize()