我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用wx.WXK_RETURN。
def check_key(self, evt): """ hotkeys: Alt+e, show dialog, also extract tags Alt+a, show dialog, without extracting tags ---Alt+q, quit the program -- deleted.. Esc, minimize the dialog to system tray Enter, add the tags """ char = evt.GetUnicodeKey() if char == wx.WXK_ESCAPE: # Esc self.Hide() elif char == wx.WXK_RETURN: tags_str = self.textbox.GetValue() if ":" in tags_str: tags_str = tags_str.replace(':', '') self.set_tags(tags_str) self.append_tags(tags_str) else: # self.textbox.WriteText("%c"%char) evt.Skip()
def OnKeyDown(self, event): if self.shell.AutoCompActive(): event.Skip() return key = event.GetKeyCode() if key == wx.WXK_RETURN: self.ih = 0 self.shell.processLine() self.shell.clearCommand() elif key == wx.WXK_UP: if self.ih < len(self.shell.history): self.ih += 1 self.shell.clearCommand() self.shell.write(self.shell.history[(self.ih-1)]) elif key == wx.WXK_DOWN: self.shell.clearCommand() self.ih -= 1 if self.ih > 0: self.shell.write(self.shell.history[self.ih - 1]) else: self.ih = 0 else: event.Skip()
def OnKeyDown(self, event): """ Do some work when the user press on the keys: up and down: move the cursor """ keycode = event.GetKeyCode() if keycode in [wx.WXK_DOWN, wx.WXK_UP]: self.PopupListBox() if keycode == wx.WXK_DOWN: self.listbox.MoveSelection(1) else: self.listbox.MoveSelection(-1) elif keycode in [wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_RETURN] and self.listbox is not None: selected = self.listbox.GetSelection() if selected != "": self.SetValueFromSelected(selected) else: event.Skip() elif event.GetKeyCode() == wx.WXK_ESCAPE: self.DismissListBox() else: event.Skip()
def OnKeyUp(self, event): event.Skip() if not self.selectedNode or not self.hot_map: return if event.KeyCode == wx.WXK_HOME: self.SetSelected(HotMapNavigator.firstNode(self.hot_map)) return elif event.KeyCode == wx.WXK_END: self.SetSelected(HotMapNavigator.lastNode(self.hot_map)) return parent, children, index = HotMapNavigator.findNode(self.hot_map, self.selectedNode) if event.KeyCode == wx.WXK_DOWN: self.SetSelected(HotMapNavigator.nextChild(children, index)) elif event.KeyCode == wx.WXK_UP: self.SetSelected(HotMapNavigator.previousChild(children, index)) elif event.KeyCode == wx.WXK_RIGHT: self.SetSelected(HotMapNavigator.firstChild(children, index)) elif event.KeyCode == wx.WXK_LEFT and parent: self.SetSelected(parent) elif event.KeyCode == wx.WXK_RETURN: wx.PostEvent(self, SquareActivationEvent(node=self.selectedNode, map=self))
def OnKeyUp(self, event): event.Skip() if not self.selectedNode or not self.hot_map: return if event.KeyCode == wx.WXK_HOME: self.SetSelected(HotMapNavigator.firstNode(self.hot_map)) return elif event.KeyCode == wx.WXK_END: self.SetSelected(HotMapNavigator.lastNode(self.hot_map)) return try: parent, children, index = HotMapNavigator.findNode(self.hot_map, self.selectedNode) except TypeError: log.info( 'Unable to find hot-map record for node %s', self.selectedNode ) else: if event.KeyCode == wx.WXK_DOWN: self.SetSelected(HotMapNavigator.nextChild(children, index)) elif event.KeyCode == wx.WXK_UP: self.SetSelected(HotMapNavigator.previousChild(children, index)) elif event.KeyCode == wx.WXK_RIGHT: self.SetSelected(HotMapNavigator.firstChild(children, index)) elif event.KeyCode == wx.WXK_LEFT and parent: self.SetSelected(parent) elif event.KeyCode == wx.WXK_RETURN: wx.PostEvent(self, SquareActivationEvent(node=self.selectedNode, map=self))
def OnContourRealKey(self, event): if event.GetKeyCode() != (wx.WXK_RETURN or wx.WXK_NUMPAD_ENTER): event.Skip() else: self.OnContourReal(event)
def OnContourRecipKey(self, event): if event.GetKeyCode() != (wx.WXK_RETURN or wx.WXK_NUMPAD_ENTER): event.Skip() else: self.OnContourRecip(event)
def OnContourSupportKey(self, event): if event.GetKeyCode() != (wx.WXK_RETURN or wx.WXK_NUMPAD_ENTER): event.Skip() else: self.OnContourSupport(event)
def OnLocationChar(self, event): keycode = event.GetKeyCode() if keycode in [wx.WXK_RETURN, wx.WXK_TAB]: self.Parent.Parent.ProcessEvent(event) elif keycode == wx.WXK_ESCAPE: self.Location.SetValue(self.Default) self.Parent.Parent.CloseEditControl() else: event.Skip()
def OnDurationChar(self, event): keycode = event.GetKeyCode() if keycode in [wx.WXK_RETURN, wx.WXK_TAB]: self.Parent.Parent.ProcessEvent(event) elif keycode == wx.WXK_ESCAPE: self.Duration.SetValue(self.Default) self.Parent.Parent.CloseEditControl() else: event.Skip()
def OnKeyPressed(self, event): if self.CallTipActive(): self.CallTipCancel() key = event.GetKeyCode() current_pos = self.GetCurrentPos() selected = self.GetSelection() text_selected = selected[0] != selected[1] # Test if caret is before Windows like new line text = self.GetText() if current_pos < len(text) and ord(text[current_pos]) == 13: newline_size = 2 else: newline_size = 1 # Disable to type any character in section header lines if (self.GetLineState(self.LineFromPosition(current_pos)) and not text_selected and key not in NAVIGATION_KEYS + [ wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]): return # Disable to delete line between code and header lines elif (self.GetCurLine()[0].strip() != "" and not text_selected and (key == wx.WXK_BACK and self.GetLineState(self.LineFromPosition(max(0, current_pos - 1))) or key in [wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE] and self.GetLineState(self.LineFromPosition(min(len(text), current_pos + newline_size))))): return elif key == 32 and event.ControlDown(): pos = self.GetCurrentPos() # Tips if event.ShiftDown(): pass # Code completion else: self.AutoCompSetIgnoreCase(False) # so this needs to match keywords = self.KEYWORDS + [var["Name"] for var in self.Controler.GetVariables()] keywords.sort() self.AutoCompShow(0, " ".join(keywords)) else: event.Skip()