我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用gi.repository.Gdk.KEY_Escape()。
def on_key_release(self, widget, event): self.disconnect(self.event_id) self.ungrab() self.event_id = None if event.keyval == Gdk.KEY_Escape: self.set_button_text() self.teaching = False return True if event.keyval == Gdk.KEY_BackSpace: self.teaching = False self.value = "" self.set_button_text() self.emit("accel-edited") return True accel_string = Gtk.accelerator_name( event.keyval, event.state ) accel_string = self.sanitize(accel_string) self.value = accel_string self.set_button_text() self.teaching = False self.emit("accel-edited") return True
def on_key_release(self, widget, event): self.disconnect(self.event_id) self.ungrab(widget.get_display()) self.event_id = None if event.keyval == Gdk.KEY_Escape: self.set_button_text() self.teaching = False return True if event.keyval == Gdk.KEY_BackSpace: self.teaching = False self.value = "" self.set_button_text() self.emit("accel-edited") return True accel_string = Gtk.accelerator_name( event.keyval, event.state ) accel_string = self.sanitize(accel_string) self.value = accel_string self.set_button_text() self.teaching = False self.emit("accel-edited") return True
def on_window_key_press_event(self, trash, event): """ Checks if pressed key was escape and if yes, closes window """ if event.keyval == Gdk.KEY_Escape: self.close()
def on_ConditionEditor_key_press_event(self, w, event): """ Checks if pressed key was escape and if yes, closes window """ if event.keyval == Gdk.KEY_Escape: self.hide_dont_destroy(w)
def _on_key_pressed(self, widget, event): # TODO: Maybe use accelerators? if event.keyval == Gdk.KEY_Escape: self._close_window() return False
def onKeyPress( self, widget, event ): if event.keyval == Gdk.KEY_Escape: self.hide() return True return False
def handler_key(event): if event.key.keyval == Gdk.KEY_Escape: return QuitLoop('Escape key', event) return None
def on_search_key(self, widget, event): if event.keyval == Gdk.KEY_Escape: self.lock_line = 0 self.searchr.set_reveal_child(False) self.search_results_sw.hide() self.webview.show()
def _on_key_press_event(self, widget, event): if event.keyval == Gdk.KEY_Escape: self._confirm_cancellation()
def on_start_window_key_press_event(self, window, event_key): if (event_key.keyval == Gdk.KEY_Escape or event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q): self.on_quit()
def on_game_window_key_press_event(self, window, event_key): if event_key.keyval == Gdk.KEY_Escape: self.game_window.hide() self.start_window.show() elif event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q: self.on_quit()
def on_replay_filechooserdialog_key_press_event(self, window, event_key): if event_key.keyval == Gdk.KEY_Escape: self.replay_filechooserdialog.hide() self.start_window.show() elif event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q: self.on_quit() # Options menu
def on_options_window_key_press_event(self, window, event_key): if event_key.keyval == Gdk.KEY_Escape: self.options_window.hide() self.start_window.show() elif event_key.state == Gdk.ModifierType.CONTROL_MASK and event_key.keyval == Gdk.KEY_q: self.on_quit()
def onWindowKeyPress( self, widget, event ): if event.keyval == Gdk.KEY_Escape: self.hide() return True return False
def on_key_press_event(self, widget, event): if event.keyval == Gdk.KEY_Left: self.x -= self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == Gdk.KEY_Right: self.x += self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == Gdk.KEY_Up: self.y -= self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval == Gdk.KEY_Down: self.y += self.POS_INCREMENT/self.zoom_ratio self.queue_draw() return True if event.keyval in (Gdk.KEY_Page_Up, Gdk.KEY_plus, Gdk.KEY_equal, Gdk.KEY_KP_Add): self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT) self.queue_draw() return True if event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_minus, Gdk.KEY_KP_Subtract): self.zoom_image(self.zoom_ratio / self.ZOOM_INCREMENT) self.queue_draw() return True if event.keyval == Gdk.KEY_Escape: self.drag_action.abort() self.drag_action = NullAction(self) return True if event.keyval == Gdk.KEY_r: self.reload() return True if event.keyval == Gdk.KEY_f: win = widget.get_toplevel() find_toolitem = win.uimanager.get_widget('/ToolBar/Find') textentry = find_toolitem.get_children() win.set_focus(textentry[0]) return True if event.keyval == Gdk.KEY_q: Gtk.main_quit() return True if event.keyval == Gdk.KEY_p: self.on_print() return True return False