当前位置: 首页>>代码示例>>Python>>正文


Python wx.WXK_UP属性代码示例

本文整理汇总了Python中wx.WXK_UP属性的典型用法代码示例。如果您正苦于以下问题:Python wx.WXK_UP属性的具体用法?Python wx.WXK_UP怎么用?Python wx.WXK_UP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.WXK_UP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_char_editor

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
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() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:20,代码来源:new_properties.py

示例2: _TimeCtrl__IncrementValue

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def _TimeCtrl__IncrementValue(self, key, pos):
        text = self.GetValue()
        field = self._FindField(pos)
        start, end = field._extent
        slice = text[start:end]
        if slice == 'A':
            newslice = 'P'
        elif slice == 'P':
            newslice = 'A'
        else:
            top = 24 if field._index == 0 else 60
            increment = 1 if key == wx.WXK_UP else -1
            newslice = "%02d" % ((int(slice) + increment) % top)
        newvalue = text[:start] + newslice + text[end:]
        try:
            self._SetValue(newvalue)
        except ValueError:  # must not be in bounds:
            if not wx.Validator_IsSilent():
                wx.Bell() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:21,代码来源:TimeCtrl.py

示例3: onFrameCharHook

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
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() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:21,代码来源:__init__.py

示例4: OnKeyDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
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() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:23,代码来源:TextCtrlAutoComplete.py

示例5: OnKeyDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnKeyDown(self, event):
        """
        Called when key is pressed in SearchCtrl text control
        @param event: wx.KeyEvent
        """
        # Get event keycode and value in SearchCtrl
        keycode = event.GetKeyCode()
        search_value = self.SearchCtrl.GetValue()

        # Up key was pressed and SearchCtrl isn't empty, search for block in
        # 'previous' mode
        if keycode == wx.WXK_UP and search_value != "":
            self.SearchInTree(search_value, "previous")

        # Down key was pressed and SearchCtrl isn't empty, search for block in
        # 'next' mode
        elif keycode == wx.WXK_DOWN and search_value != "":
            self.SearchInTree(search_value, "next")

        # Handle key normally
        else:
            event.Skip() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:24,代码来源:LibraryPanel.py

示例6: OnKeyDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnKeyDown(self, event):
        button = None
        keycode = event.GetKeyCode()
        if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD):
            button = self.GetNewButton()
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
            button = self.GetDelButton()
        elif keycode == wx.WXK_UP and event.ShiftDown():
            button = self.GetUpButton()
        elif keycode == wx.WXK_DOWN and event.ShiftDown():
            button = self.GetDownButton()
        elif keycode == wx.WXK_SPACE:
            button = self.GetEditButton()
        if button is not None and button.IsEnabled():
            button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId()))
        else:
            event.Skip() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:19,代码来源:CustomEditableListBox.py

示例7: OnKeyPressed

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.nextLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_UP:
            self.previousLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                f"Do you want to remove the label {closest_dp.individual_names}:{closest_dp.bodyParts}?",
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data()
                self.buttonCounter[closest_dp.individual_names].remove(
                    closest_dp.bodyParts
                ) 
开发者ID:DeepLabCut,项目名称:DeepLabCut,代码行数:32,代码来源:multiple_individuals_labeling_toolbox.py

示例8: OnKeyPressed

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.nextLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_UP:
            self.previousLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % closest_dp.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data()
                self.buttonCounter.remove(
                    self.bodyparts.index(closest_dp.bodyParts)
                ) 
开发者ID:DeepLabCut,项目名称:DeepLabCut,代码行数:32,代码来源:labeling_toolbox.py

示例9: on_char

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def on_char(self, event):
        key = (event.GetKeyCode(), event.GetModifiers())    # modifiers: 1,2,4 for Alt, Ctrl, Shift

        focused = self.FindFocus()
        if not focused or not focused.Id in self._id_to_coordinate:
            return event.Skip()

        row, col = self._id_to_coordinate[focused.Id]
        new_row = new_col = None
        if key[0]==wx.WXK_UP:
            if row>0: new_row = row-1
        elif key[0]==wx.WXK_DOWN:
            if row < len(self._ids_by_row)-1: new_row = row+1
        elif key[0]==wx.WXK_LEFT:
            if col>0: new_col = col-1
        elif key[0]==wx.WXK_RIGHT:
            if col < len(self._ids_by_row[row])-1: new_col = col+1
        elif key[0]==wx.WXK_HOME:
            new_col = 0
        elif key[0]==wx.WXK_END:
            new_col = len(self._ids_by_row[row])-1
        elif key[0]==wx.WXK_PAGEUP:
            new_row = 0
        elif key[0]==wx.WXK_PAGEDOWN:
            new_row = len(self._ids_by_row)-1
        elif (ord("A") <= key[0] <= ord("Z")) and chr(key[0]) in misc.palette_hotkeys:
            section = misc.palette_hotkeys[chr(key[0])]
            new_row = self._section_to_row[section]
            new_col = 0
        else:
            return event.Skip()

        if new_row is None and new_col is None:
            # limits hit
            wx.Bell()
        else:
            if new_col is None: new_col = min(col, len(self._ids_by_row[new_row])-1)
            if new_row is None: new_row = row
            focus = self.FindWindowById(self._ids_by_row[new_row][new_col])
            if focus: focus.SetFocus() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:42,代码来源:main.py

示例10: on_char

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def on_char(self, event):
        "called from main: start label editing on F2; skip events while editing"
        keycode = event.GetKeyCode()
        if keycode==wx.WXK_F2 and self.cur_widget and self.cur_widget._label_editable():
            # start label editing
            self.EditLabel( self.cur_widget.item )
            return True
        if isinstance(self.FindFocus(), wx.TextCtrl):
            # currently editing
            event.Skip()
            return True
        if keycode in (wx.WXK_UP, wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT):
            event.Skip()
            return True
        return False 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:17,代码来源:tree.py

示例11: OnChar

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnChar(self, event):
        key = event.GetKeyCode()
        if key == wx.WXK_UP:
            self.OnSpinUp(event)
            return
        if key == wx.WXK_DOWN:
            self.OnSpinDown(event)
            return
        event.Skip() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:11,代码来源:SpinNumCtrl.py

示例12: on_key_down

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def on_key_down(self, event):
        key = event.GetKeyCode()
        try:
            if key == wx.WXK_DOWN:
                self.text_entry.SetValue(self.command_log[self.command_position + 1])
                wx.CallAfter(self.text_entry.SetInsertionPointEnd)
                self.command_position += 1
            elif key == wx.WXK_UP:
                self.text_entry.SetValue(self.command_log[self.command_position - 1])
                wx.CallAfter(self.text_entry.SetInsertionPointEnd)
                self.command_position -= 1
        except IndexError:
            pass
        event.Skip() 
开发者ID:meerk40t,项目名称:meerk40t,代码行数:16,代码来源:Terminal.py

示例13: OnKeyDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnKeyDown(self, event):
        key_handled = False
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_TAB:
            row = self.GetGridCursorRow()
            col = self.GetGridCursorCol()
            if event.ShiftDown():
                if row < 0 or col == 0:
                    self.Navigate(wx.NavigationKeyEvent.IsBackward)
                    key_handled = True
            elif row < 0 or col == self.Table.GetNumberCols() - 1:
                self.Navigate(wx.NavigationKeyEvent.IsForward)
                key_handled = True
        elif keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD) and self.Editable:
            self.AddRow()
            key_handled = True
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and self.Editable:
            self.DeleteRow()
            key_handled = True
        elif keycode == wx.WXK_UP and event.ShiftDown() and self.Editable:
            self.MoveRow(self.GetGridCursorRow(), -1)
            key_handled = True
        elif keycode == wx.WXK_DOWN and event.ShiftDown() and self.Editable:
            self.MoveRow(self.GetGridCursorRow(), 1)
            key_handled = True
        if not key_handled:
            event.Skip() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:29,代码来源:CustomGrid.py

示例14: OnKeyDown

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def OnKeyDown(self, event):
        key = event.GetUnicodeKey()
        if key == wx.WXK_NONE:
            key = event.GetKeyCode()
        dxs = {wx.WXK_LEFT: -1, wx.WXK_RIGHT: +1, wx.WXK_UP: 0, wx.WXK_DOWN: 0}
        dys = {wx.WXK_LEFT: 0, wx.WXK_RIGHT: 0, wx.WXK_UP: +1, wx.WXK_DOWN: -1}

        if key in dxs:
            dx = dxs[key]
            dy = dys[key]
            if event.ShiftDown():
                scale = 0.1
            else:
                scale = 1.0
            self.do_Step(dx, dy, scale) 
开发者ID:dials,项目名称:dials,代码行数:17,代码来源:geometry_viewer.py

示例15: barcodeInput

# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_UP [as 别名]
def barcodeInput(self, event):
        if event.GetKeyCode() == wx.WXK_UP:
            self.suggestionList.SetSelection(self.suggestionList.GetSelection() - 1)
            return
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.suggestionList.SetSelection(self.suggestionList.GetSelection() + 1)
            return
        c = event.GetUnicodeKey()
        if c is 8:
            # backspace
            self.inputStream = self.inputStream[:-1]
        if c is 27:
            # esc key
            self.inputStream = ''
        if c in range(48, 91):
            # number or alphabet
            self.inputStream = self.inputStream + chr(c)
        if c is 13:
            # enter key
            listSelection = self.suggestionList.GetString(self.suggestionList.GetSelection())
            print(listSelection)
            if listSelection == "New Product":
                self.newProd(self.inputTC.GetValue())
                # i had to make the connection again because it wasn't fetching values (this was moved to cart.py)
                # self.t.conn = connectToDB()
                x = self.t.findProduct(self.inputTC.GetValue(), 1)
                print(x)
            else:
                x = self.t.findProduct(listSelection.split()[0], 1)
            if x == True:
                self.dumpCartInDvlc()
                self.inputStream = ''
                self.hideSearchSuggestion(None)
            '''
            else:
                x = self.t.findProduct( listSelection.split()[0] , 1 )
                print(x)
                if x == True:
                    self.dumpCartInDvlc()
                    self.inputStream = ''
                    self.hideSearchSuggestion(None)
            '''
        self.inputTC.SetValue(self.inputStream) 
开发者ID:104H,项目名称:HH---POS-Accounting-and-ERP-Software,代码行数:45,代码来源:backupTerminalFrontEnd.py


注:本文中的wx.WXK_UP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。