Python wx.WXK_ESCAPE Examples

The following are 24 code examples of wx.WXK_ESCAPE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: TextCtrlAutoComplete.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #2
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def on_char_editor(self, event):
        # EVT_CHAR_HOOK handler
        keycode = event.KeyCode
        if keycode not in (wx.WXK_RETURN, wx.WXK_ESCAPE, wx.WXK_UP, wx.WXK_DOWN):
            event.Skip()
            return

        if keycode == wx.WXK_ESCAPE:
            self._update_editors()
            return

        self._on_editor_edited(event)
        if keycode==wx.WXK_UP:
            self._set_row_index( self.cur_row - 1 )
        elif keycode==wx.WXK_DOWN:
            self._set_row_index( self.cur_row + 1 )

        self._update_editors() 
Example #3
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def onFrameCharHook(self, event):
        keyCode = event.GetKeyCode()
        if keyCode == wx.WXK_F4:
            if event.AltDown():
                self.destroyMenu()
        elif keyCode == wx.WXK_RETURN or keyCode == wx.WXK_NUMPAD_ENTER:
            self.DefaultAction()
        elif keyCode == wx.WXK_RIGHT or keyCode == wx.WXK_NUMPAD_RIGHT:
            self.DefaultAction()
        elif keyCode == wx.WXK_ESCAPE:
            self.destroyMenu()
        elif keyCode == wx.WXK_UP or keyCode == wx.WXK_NUMPAD_UP:
            self.menuGridCtrl.MoveCursor(-1)
        elif keyCode == wx.WXK_DOWN or keyCode == wx.WXK_NUMPAD_DOWN:
            self.menuGridCtrl.MoveCursor(1)
        elif keyCode == wx.WXK_LEFT or keyCode == wx.WXK_NUMPAD_LEFT:
            if len(self.oldMenu) > 0:
                self.menu, ix = self.oldMenu.pop()
                wx.CallAfter(self.UpdateMenu,ix)
            else:
                self.destroyMenu()
        else:
            event.Skip() 
Example #4
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def onFrameCharHook(self, event):
        keyCode = event.GetKeyCode()
        if keyCode == wx.WXK_F4:
            if event.AltDown():
                self.destroyMenu()
        elif keyCode == wx.WXK_RETURN or keyCode == wx.WXK_NUMPAD_ENTER:
            self.GoTo()
        elif keyCode == wx.WXK_RIGHT or keyCode == wx.WXK_NUMPAD_RIGHT:
            self.MoveCursor(1)
        elif keyCode == wx.WXK_ESCAPE:
            self.destroyMenu()
        elif keyCode == wx.WXK_UP or keyCode == wx.WXK_NUMPAD_UP:
            self.Turn(1)
        elif keyCode == wx.WXK_DOWN or keyCode == wx.WXK_NUMPAD_DOWN:
            self.Turn(-1)
        elif keyCode == wx.WXK_LEFT or keyCode == wx.WXK_NUMPAD_LEFT:
            self.MoveCursor(-1)
        else:
            event.Skip() 
Example #5
Source File: spellcheckdlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def OnChar(self, event):
        kc = event.GetKeyCode()

        if kc == wx.WXK_ESCAPE:
            self.EndModal(wx.ID_OK)

            return

        event.Skip() 
Example #6
Source File: CellEditor.py    From bookhub with MIT License 5 votes vote down vote up
def __init__(self, acceptableChars="0123456789+-"):
        wx.PyValidator.__init__(self)
        self.Bind(wx.EVT_CHAR, self._OnChar)
        self.acceptableChars = acceptableChars
        self.acceptableCodes = [ord(x) for x in self.acceptableChars]
        stdEditKeys = [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER, wx.WXK_ESCAPE, wx.WXK_CANCEL,
                       wx.WXK_TAB, wx.WXK_BACK, wx.WXK_DELETE, wx.WXK_HOME, wx.WXK_END,
                       wx.WXK_LEFT, wx.WXK_RIGHT]
        self.acceptableCodes.extend(stdEditKeys) 
Example #7
Source File: LocationCellEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #8
Source File: FindInPouDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.OnCloseButton(event)
        else:
            event.Skip() 
Example #9
Source File: SearchInProjectDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.OnCloseButton(event)
        else:
            event.Skip() 
Example #10
Source File: IDMergeDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.EndModal(wx.ID_CANCEL)
        else:
            event.Skip() 
Example #11
Source File: IDManager.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.EndModal(wx.ID_CANCEL)
        else:
            event.Skip() 
Example #12
Source File: Adjustments.py    From meerk40t with MIT License 5 votes vote down vote up
def on_key_press(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.Close()
        event.Skip() 
Example #13
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def OnChar(self, event):
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            wx.Frame.Show(self, False)
        event.Skip() 
Example #14
Source File: wx_app.py    From pyopenvr with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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() 
Example #15
Source File: application.py    From wxGlade with MIT License 5 votes vote down vote up
def on_char_hook(self, event):
        # handler for EVT_CHAR_HOOK events on preview windows
        if event.GetKeyCode()==wx.WXK_ESCAPE:
            wx.FindWindowById(event.GetId()).GetTopLevelParent().Close()
            return
        misc.handle_key_event(event, "preview") 
Example #16
Source File: new_properties.py    From wxGlade with MIT License 5 votes vote down vote up
def on_char(self, event):
        if self.text is None: return
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            # reset
            self.text.SetValue( self._convert_to_text(self.value) )
            if self.text.GetInsertionPoint()!=-1:
                self.text.SetInsertionPointEnd()
        if not self.multiline and keycode==13:
            # enter
            if self._check_for_user_modification(): return
        event.Skip() 
Example #17
Source File: SettingsWindow.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def key(self, event):
        c = event.GetKeyCode()
        if c == wx.WXK_ESCAPE:
            self.close()
        event.Skip() 
Example #18
Source File: DownloadManager.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def key(self, event):
        c = event.GetKeyCode()
        if c == wx.WXK_ESCAPE:
            self.close()
        event.Skip() 
Example #19
Source File: DownloadManager.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def key(self, event):
        c = event.GetKeyCode()
        if c == wx.WXK_ESCAPE:
            self.close()
        event.Skip() 
Example #20
Source File: __init__.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def key(self, event):
        c = event.GetKeyCode()
        if c == wx.WXK_ESCAPE:
            self.EndModal(wx.ID_CANCEL)
        event.Skip() 
Example #21
Source File: viewer.py    From GraphLayout with MIT License 5 votes vote down vote up
def on_char(self, event):
        event.Skip()
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            self.GetParent().Close()
        elif event.GetKeyCode() == wx.WXK_SPACE:
            self.next() 
Example #22
Source File: finddlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def OnChar(self, event, isEntry, isButton):
        kc = event.GetKeyCode()

        if kc == wx.WXK_ESCAPE:
            self.EndModal(wx.ID_OK)
            return

        if kc == wx.WXK_RETURN:
            if isButton:
                event.Skip()
                return
            else:
                self.OnFind()
                return

        if isEntry:
            event.Skip()
        else:
            if kc < 256:
                if chr(kc) == "f":
                    self.OnFind()
                elif chr(kc) == "r":
                    self.OnReplace()
                else:
                    event.Skip()
            else:
                event.Skip() 
Example #23
Source File: misc.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def OnChar(self, event, isEntry):
        kc = event.GetKeyCode()

        if kc == wx.WXK_ESCAPE:
            self.OnCancel()

        elif (kc == wx.WXK_RETURN) and isEntry:
                self.OnOK()

        else:
            event.Skip() 
Example #24
Source File: ObjectListView.py    From bookhub with MIT License 4 votes vote down vote up
def _HandleChar(self, evt):
        if evt.GetKeyCode() == wx.WXK_F2 and not self.IsCellEditing():
            return self._PossibleStartCellEdit(self.GetFocusedRow(), self.GetPrimaryColumnIndex())

        # We have to catch Return/Enter/Escape here since some types of controls
        # (e.g. ComboBox, UserControl) don't trigger key events that we can listen for.
        # Treat Return or Enter as committing the current edit operation unless the control
        # is a multiline text control, in which case we treat it as data
        if evt.GetKeyCode() in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER) and self.IsCellEditing():
            if self.cellEditor and self.cellEditor.HasFlag(wx.TE_MULTILINE):
                return evt.Skip()
            else:
                return self.FinishCellEdit()

        # Treat Escape as cancel the current edit operation
        if evt.GetKeyCode() in (wx.WXK_ESCAPE, wx.WXK_CANCEL) and self.IsCellEditing():
            return self.CancelCellEdit()

        # Tab to the next editable column
        if evt.GetKeyCode() == wx.WXK_TAB and self.IsCellEditing():
            return self._HandleTabKey(evt.ShiftDown())

        # Space bar with a selection on a listview with checkboxes toggles the checkboxes
        if (evt.GetKeyCode() == wx.WXK_SPACE and
            not self.IsCellEditing() and
            self.checkStateColumn is not None and
            self.GetSelectedItemCount() > 0):
            return self._ToggleCheckBoxForSelection()

        if not self.IsCellEditing():
            if self._HandleTypingEvent(evt):
                return

        if not self.IsCellEditing() and self.handleStandardKeys:
            # Copy selection on Ctrl-C
            # Why is Ctrl-C represented by 3?! Is this Windows only?
            if (evt.GetKeyCode() == 3):
                self.CopySelectionToClipboard()
                return
            # Select All on Ctrl-A
            if (evt.GetKeyCode() == 1):
                self.SelectAll()
                return

        evt.Skip()