python类WXK_ESCAPE的实例源码

matags.py 文件源码 项目:MaTags 作者: hastelloy 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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()
TextCtrlAutoComplete.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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()
gripy_debug_console.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def onInputChar(self, evt):
        key = evt.GetKeyCode()
        if key == wx.WXK_TAB:
            data = self.inputCtrl.GetValue()
            ins_point = self.inputCtrl.GetInsertionPoint()
            last_point = self.inputCtrl.GetLastPosition()
            line_number = len(data[0:ins_point].split("\n"))
            if line_number > 1:
                ins_point -= line_number - 1
            data = data[0:ins_point] + '    ' + data[ins_point:last_point]
            self.inputCtrl.ChangeValue(data)
            self.inputCtrl.SetInsertionPoint(ins_point+3+line_number)
            return
        elif key == wx.WXK_F6:
            self.outputCtrl.SetFocus()
            return
        elif key == wx.WXK_ESCAPE:
            self.Close()
            return
        evt.Skip()
recipe-496868.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def escapeSuppressor(evt):
    """wx.EVT_CHAR_HOOK handler that suppresses processing ESC.
    By default, if you don't have a Cancel button, wx will trigger the
    OK button when you press ESC. Binding this to a dialog will deactivate
    the ESC key. We need this when there is no Cancel button.
    """
    evt.Skip(evt.GetKeyCode() != wx.WXK_ESCAPE)
wx_app.py 文件源码 项目:pyopenvr 作者: cmbruns 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def OnChar ( self, event ):
        key = event.GetKeyCode()
        # print (key)
        if key == ord('q') or key == ord('Q') or key == wx.WXK_ESCAPE: # Q or ESCAPE
            # print ("closing")
            self.window.Close()
            sys.exit(0) # In non-debug mode, Frame.Close() does not seem to close the application
            return
        #self.window.Refresh(False)
        event.Skip()
test_wx.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def main():

    def onKeyDown(event):
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            frame.Close()

    app = wx.App(0)
    frame = wx.Frame(None, title="Hello World from wxPython")
    panel = wx.Panel(frame)
    label = wx.StaticText(panel, -1,
                          u"Press <ESC> to exit. Some non-ascii chars: ??š?íá?")
    panel.Bind(wx.EVT_KEY_DOWN, onKeyDown)
    panel.SetFocus()
    frame.Show()
    app.MainLoop()
FindInPouDialog.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.OnCloseButton(event)
        else:
            event.Skip()
SearchInProjectDialog.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.OnCloseButton(event)
        else:
            event.Skip()
LocationCellEditor.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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()
DurationCellEditor.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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()
fullscreen.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def onKey(self, event):
        """
        Check for ESC key press and exit is ESC is pressed
        """
        key_code = event.GetKeyCode()
        if key_code == wx.WXK_ESCAPE:
            self.GetParent().Close()
        else:
            event.Skip()
test_wx.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main():

    def onKeyDown(event):
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            frame.Close()

    app = wx.App(0)
    frame = wx.Frame(None, title="Hello World from wxPython")
    panel = wx.Panel(frame)
    label = wx.StaticText(panel, -1,
                          u"Press <ESC> to exit. Some non-ascii chars: ??š?íá?")
    panel.Bind(wx.EVT_KEY_DOWN, onKeyDown)
    panel.SetFocus()
    frame.Show()
    app.MainLoop()
gripy_debug_console.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def onOutputKeyDown(self, evt):
        key = evt.GetKeyCode()
        # #3763: WX 3 no longer passes escape to evt_char for richEdit fields, therefore evt_key_down is used.
        if key == wx.WXK_ESCAPE:
            self.Close()
            return
        evt.Skip()


问题


面经


文章

微信
公众号

扫码关注公众号