Python pygame 模块,K_TAB 实例源码

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

项目:eduActiv8    作者:imiolek-ireneusz    | 项目源码 | 文件源码
def onKeyDown(self, event):
        if not self.select_item:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_DELETE:
                pass
            elif event.type == pygame.KEYDOWN and event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER and event.key != pygame.K_TAB:
                lhv = len(self.value)
                if event.key == pygame.K_BACKSPACE:
                    if lhv > 0:
                        if self.ls.lang.ltr_text:
                            self.value = self.value[0:lhv - 1]
                        else:
                            self.value = self.value[1:lhv]
                else:
                    char = event.unicode
                    if len(char) > 0 and lhv < 21:
                        if self.ls.lang.ltr_text:
                            self.value = self.value + char
                        else:
                            self.value = char + self.value
                self.ls.reload_selects()
                self.ls.set_scrollbar_top(self.ls.scroll_min_top)
            elif event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER or event.key == pygame.K_TAB:
                self.nextFocus()

            self.update_trigger()
项目:pyimgui    作者:swistakm    | 项目源码 | 文件源码
def _map_keys(self):
        key_map = self.io.key_map

        key_map[imgui.KEY_TAB] = pygame.K_TAB
        key_map[imgui.KEY_LEFT_ARROW] = pygame.K_LEFT
        key_map[imgui.KEY_RIGHT_ARROW] = pygame.K_RIGHT
        key_map[imgui.KEY_UP_ARROW] = pygame.K_UP
        key_map[imgui.KEY_DOWN_ARROW] = pygame.K_DOWN
        key_map[imgui.KEY_PAGE_UP] = pygame.K_PAGEUP
        key_map[imgui.KEY_PAGE_DOWN] = pygame.K_PAGEDOWN
        key_map[imgui.KEY_HOME] = pygame.K_HOME
        key_map[imgui.KEY_END] = pygame.K_END
        key_map[imgui.KEY_DELETE] = pygame.K_DELETE
        key_map[imgui.KEY_BACKSPACE] = pygame.K_BACKSPACE
        key_map[imgui.KEY_ENTER] = pygame.K_RETURN
        key_map[imgui.KEY_ESCAPE] = pygame.K_ESCAPE
        key_map[imgui.KEY_A] = pygame.K_a
        key_map[imgui.KEY_C] = pygame.K_c
        key_map[imgui.KEY_V] = pygame.K_v
        key_map[imgui.KEY_X] = pygame.K_x
        key_map[imgui.KEY_Y] = pygame.K_y
        key_map[imgui.KEY_Z] = pygame.K_z
项目:cyberlab    作者:kuroneko1996    | 项目源码 | 文件源码
def focus_change(self):
        if self.key_entered == pg.K_TAB or self.key_entered == pg.K_DOWN:
            self.kbd_item = 0
            self.key_entered = 0
            if self.key_shift:  # move back
                self.kbd_item = self.last_widget
            return True
        elif self.key_entered == pg.K_UP:
            self.key_entered = 0
            self.kbd_item = self.last_widget
            return True
        else:
            return False
项目:jackit    作者:vix597    | 项目源码 | 文件源码
def handle_event(self, event):
        '''
        Handle input events while the code editor is up.
        Overrides the code editor version
        '''
        if event.type == pygame.KEYDOWN:
            self.text_change = True

            if not self.initial_edit and event.key != pygame.K_RETURN:
                self.initial_edit = True
                self.text = ""

            if event.key == pygame.K_RETURN and self.initial_edit:
                self.stop()
            elif event.key == pygame.K_RETURN:
                pass
            elif event.key == pygame.K_DELETE:
                self.k_delete()
            elif event.key == pygame.K_LEFT:
                self.k_left()
            elif event.key == pygame.K_RIGHT:
                self.k_right()
            elif event.key == pygame.K_BACKSPACE:
                self.k_backspace()
            elif event.key == pygame.K_TAB:
                pass
            elif event.key == pygame.K_ESCAPE:
                pass
            else:
                self.character_key(event.key)

        return True # keep processing events
项目:jackit    作者:vix597    | 项目源码 | 文件源码
def handle_event(self, event):
        '''
        Handle input events while the code editor is up
        '''
        if event.type == pygame.KEYDOWN:
            self.text_change = True

            if event.key == pygame.K_ESCAPE:
                self.stop()
            elif event.key == pygame.K_DELETE:
                self.k_delete()
            elif event.key == pygame.K_LEFT:
                self.k_left()
            elif event.key == pygame.K_RIGHT:
                self.k_right()
            elif event.key == pygame.K_BACKSPACE:
                self.k_backspace()
            elif event.key == pygame.K_TAB:
                self.k_tab()
            elif event.key == pygame.K_RETURN:
                self.k_return()
            elif event.key == pygame.K_UP:
                self.k_up()
            elif event.key == pygame.K_DOWN:
                self.k_down()
            else:
                self.character_key(event.key)

        return True # keep processing events
项目:PyMonopoly    作者:Kycko    | 项目源码 | 文件源码
def init_for_group(self, number):
        self.HOTKEYS = ()
        if self.group == 'onboard_select_cell':
            self.cursor = FieldCellCursor(self.active_zone)
            self.tooltip = Tooltip(number, 'fieldcells_info')
        elif self.group == 'pl_info_tab':
            self.cursor = OwnCursor('light_blue', self.active_zone)
            self.tooltip = Tooltip(Globals.PLAYERS[number].name, 'left', self.text, 'ubuntu_13')
        elif self.group == 'from_game_return_to_menu':
            self.cursor = OwnCursor('light_brown', self.active_zone)
            self.tooltip = Tooltip(u'HOTKEY: Escape', 'left', self.text)
            self.HOTKEYS = (pygame.K_ESCAPE)
        elif self.group == 'show_menu':
            self.cursor = OwnCursor('orange', self.active_zone)
            self.tooltip = Tooltip(u'HOTKEYS: PageDown, PageUp', 'downright', self.text)
            self.HOTKEYS = (pygame.K_PAGEDOWN, pygame.K_PAGEUP)
        elif self.group == 'show_prev_trades':
            self.cursor = OwnCursor('orange', self.active_zone)
            self.tooltip = Tooltip(u'HOTKEYS: Tab', 'left', self.text)
            self.HOTKEYS = (pygame.K_TAB, None)
        elif self.group == 'volume_in_game':
            self.cursor = OwnCursor('grey', self.active_zone)
            self.tooltip = None
        elif self.group == 'music_and_sound_switches':
            self.cursor = OwnCursor('light_blue', self.active_zone)
            self.tooltip = None
        elif self.group == 'stats_switch':
            self.cursor = OwnCursor('light_green', self.active_zone)
            self.tooltip = Tooltip(u'HOTKEYS: ? ?', 'top', self.text)
        else:
            self.tooltip = None
项目:myterminal    作者:graktung    | 项目源码 | 文件源码
def readChar():
    if event.key == pygame.K_BACKSPACE:
        return 'backspace'
    elif event.key == pygame.K_PAGEUP:
        return 'pageup'
    elif event.key == pygame.K_PAGEDOWN:
        return 'pagedown'
    elif event.key == pygame.K_TAB:
        return 'tab'
    elif event.key == pygame.K_RETURN:
        return 'enter'
    elif event.key == pygame.K_ESCAPE:
        return 'esc'
    elif event.key in (pygame.K_RSHIFT, pygame.K_LSHIFT):
        return 'shift'
    elif event.key in (pygame.K_RCTRL, pygame.K_LCTRL):
        return 'control'
    elif event.key == pygame.K_RIGHT:
        return 'kright'
    elif event.key == pygame.K_LEFT:
        return 'kleft'
    elif event.key == pygame.K_UP:
        return 'kup'
    elif event.key == pygame.K_DOWN:
        return 'kdown'
    elif event.key == pygame.K_CAPSLOCK:
        return None
    elif event.key == 282:
        return 'paste'
    elif event.key == 283:
        return 'begincur'
    elif event.key == 284:
        return 'endcur'
    elif event.key == 285:
        return 'delall'
    else:
        return event.unicode