Python pygame 模块,K_PAGEDOWN 实例源码

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

项目: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
项目:sftext    作者:LukeMS    | 项目源码 | 文件源码
def on_key_press(self, event):
        if event.type == pygame.KEYDOWN and event.key == pygame.K_UP:
            self.scroll(50)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_PAGEUP:
            self.scroll(500)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_HOME:
            self.scroll('home')

        elif event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
            self.scroll(-50)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_PAGEDOWN:
            self.scroll(-500)
        elif event.type == pygame.KEYDOWN and event.key == pygame.K_END:
            self.scroll('end')
项目:nautical-combat    作者:horstjens    | 项目源码 | 文件源码
def run(self):
        """The mainloop
        """
        #self.paint() 
        running = True
        while running:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    running = False 
                elif event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        running = False
                    if event.key==pygame.K_UP:
                        #print(m.active_itemnumber)
                        self.offset_y += 50
                        #self.sound2.play()
                    if event.key==pygame.K_DOWN:
                        self.offset_y -= 50
                    if event.key==pygame.K_LEFT:
                        self.x += self.dy
                    if event.key == pygame.K_RIGHT:
                        self.x -= self.dy
                    if event.key == pygame.K_PAGEUP:
                        self.offset_y += self.height
                    if event.key == pygame.K_PAGEDOWN:
                        self.offset_y -= self.height


            milliseconds = self.clock.tick(self.fps)
            seconds = milliseconds / 1000.0 # important for python2
            self.offset_y -= seconds * 10 # scroll 10 pixels / second
            if self.offset_y * -1 > self.text_height:
                running = False
            self.playtime += milliseconds / 1000.0
            self.paint()
            pygame.display.flip()
            self.screen.blit(self.background, (0, 0))

        #pygame.quit()
        return
项目: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
项目:mini_rpg    作者:paolo-perfahl    | 项目源码 | 文件源码
def run(self):
        """The mainloop
        """
        #self.paint() 
        running = True
        while running:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    running = False 
                elif event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        running = False
                    if event.key==pygame.K_UP:
                        #print(m.active_itemnumber)
                        self.offset_y += 50
                        #self.sound2.play()
                    if event.key==pygame.K_DOWN:
                        self.offset_y -= 50
                    if event.key==pygame.K_LEFT:
                        self.x -= self.dy
                    if event.key == pygame.K_RIGHT:
                        self.x += self.dy
                    if event.key == pygame.K_PAGEUP:
                        self.offset_y += self.height
                    if event.key == pygame.K_PAGEDOWN:
                        self.offset_y -= self.height


            milliseconds = self.clock.tick(self.fps)
            seconds = milliseconds / 1000.0 # important for python2
            self.offset_y -= seconds * 10 # scroll 10 pixels / second
            if self.offset_y * -1 > self.text_height:
                running = False
            self.playtime += milliseconds / 1000.0
            self.paint()
            pygame.display.flip()
            self.screen.blit(self.background, (0, 0))

        #pygame.quit()
        return
项目: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