Python wx 模块,WXK_RIGHT 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用wx.WXK_RIGHT

项目:tindieorderprintout    作者:limpkin    | 项目源码 | 文件源码
def on_key_event(self, event):
        """ Respond to a keypress event.

            We make the arrow keys move the selected object(s) by one pixel in
            the given direction.
        """
        step = 1
        if event.ControlDown():
            step = 20

        if event.GetKeyCode() == wx.WXK_UP:
            self.move_elements(0, -step)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.move_elements(0, step)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.move_elements(-step, 0)
        elif event.GetKeyCode() == wx.WXK_RIGHT:
            self.move_elements(step, 0)
        elif event.GetKeyCode() == wx.WXK_DELETE:
            self.do_cut()
        else:
            event.Skip()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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()
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
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))
项目:pypilot    作者:pypilot    | 项目源码 | 文件源码
def wxglutkeypress(event, special, key):
    translation = { wx.WXK_UP : GLUT_KEY_UP, wx.WXK_DOWN : GLUT_KEY_DOWN, \
                    wx.WXK_LEFT : GLUT_KEY_LEFT, wx.WXK_RIGHT : GLUT_KEY_RIGHT, \
                    wx.WXK_INSERT : GLUT_KEY_INSERT, wx.WXK_DELETE : GLUT_KEY_DELETE}
    if event.GetKeyCode() in translation:
        special(translation[event.GetKeyCode()], event.GetPosition().x, event.GetPosition().y)
    else:
        code = event.GetKeyCode()
        if code < 255:
            k = '%c' % code
            if not event.GetModifiers() & wx.MOD_SHIFT:
                k = k.lower()
            key(k, event.GetPosition().x, event.GetPosition().y)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def onKeyPress(self, event):
        keycode = event.GetKeyCode()

        if keycode == ord('A') or keycode == ord('a') or keycode == wx.WXK_LEFT:
            self.movePaddleLeft()

        if keycode == ord('D') or keycode == ord('d') or keycode == wx.WXK_RIGHT:
            self.movePaddleRight()

        if keycode == ord('R') or keycode == ord('r'):
            self.startGame()
项目:squaremap3    作者:kawaiicthulhu    | 项目源码 | 文件源码
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))
项目:python_2048    作者:OATOMO    | 项目源码 | 文件源码
def onKeyDown(self,event):
        keyCode = event.GetKeyCode()

        if keyCode==wx.WXK_UP:
            self.doMove(*self.slideUpDown(True))
        elif keyCode==wx.WXK_DOWN:
            self.doMove(*self.slideUpDown(False))
        elif keyCode==wx.WXK_LEFT:
            self.doMove(*self.slideLeftRight(True))
        elif keyCode==wx.WXK_RIGHT:
            self.doMove(*self.slideLeftRight(False))
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_keydown_contacts(self,event):
        keycode=event.GetKeyCode()
        if keycode==wx.WXK_BACK or keycode==wx.WXK_CANCEL or keycode==wx.WXK_CLEAR or keycode==wx.WXK_DELETE or keycode==wx.WXK_DOWN or keycode==wx.WXK_END or keycode==wx.WXK_LBUTTON :

            event.Skip()
            return 0
        elif keycode==wx.WXK_NUMPAD_END or keycode==wx.WXK_NUMPAD_NEXT or keycode==wx.WXK_NUMPAD_RIGHT or keycode==wx.WXK_RIGHT or keycode==wx.WXK_LEFT or keycode==wx.WXK_NEXT or keycode==wx.WXK_NUMPAD_DELETE or keycode==wx.WXK_NUMPAD_LEFT:
            event.Skip()
            return 0

        character=chr(keycode)
        if character.isdigit() or character==';':
            event.Skip()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def OnChar(self, event):
        if self.GetDrawingMode() == FREEDRAWING_MODE:
            Viewer.OnChar(self, event)
        else:
            xpos, ypos = self.GetScrollPos(wx.HORIZONTAL), self.GetScrollPos(wx.VERTICAL)
            xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL)
            ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL)
            keycode = event.GetKeyCode()
            if keycode == wx.WXK_DELETE and self.SelectedElement:
                if self.IsBlock(self.SelectedElement):
                    self.SelectedElement.Delete()
                elif self.IsWire(self.SelectedElement):
                    self.DeleteWire(self.SelectedElement)
                elif isinstance(self.SelectedElement, Graphic_Group):
                    all_wires = True
                    for element in self.SelectedElement.GetElements():
                        all_wires &= self.IsWire(element)
                    if all_wires:
                        self.DeleteWire(self.SelectedElement)
                    else:
                        self.SelectedElement.Delete()
                self.RefreshBuffer()
                self.RefreshScrollBars()
                self.Refresh(False)
            elif keycode == wx.WXK_LEFT:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(0, ypos)
                elif event.ControlDown():
                    self.Scroll(max(0, xpos - 1), ypos)
            elif keycode == wx.WXK_RIGHT:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(xmax, ypos)
                elif event.ControlDown():
                    self.Scroll(min(xpos + 1, xmax), ypos)
            elif keycode == wx.WXK_UP:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(xpos, 0)
                elif event.ControlDown():
                    self.Scroll(xpos, max(0, ypos - 1))
            elif keycode == wx.WXK_DOWN:
                if event.ControlDown() and event.ShiftDown():
                    self.Scroll(xpos, ymax)
                elif event.ControlDown():
                    self.Scroll(xpos, min(ypos + 1, ymax))
            else:
                event.Skip()

    # -------------------------------------------------------------------------------
    #                  Model adding functions from Drop Target
    # -------------------------------------------------------------------------------