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


Python pygame.K_F11属性代码示例

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


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

示例1: check_keypress

# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_F11 [as 别名]
def check_keypress():
    try:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_q or event.key == pygame.K_a or event.key == pygame.K_KP_DIVIDE or event.key == pygame.K_BACKSPACE:
                    logger.debug("Keypress 'a' or 'q' or 'backspace' or 'keypad /' detected.")
                    return "end_event"
                if event.key == pygame.K_n or event.key == pygame.K_SPACE or event.key == pygame.K_KP_PLUS:
                    logger.debug("Keypress 'n' or 'space' or 'keypad +' detected.")
                    return "next_event"
                if event.key == pygame.K_r or event.key == pygame.K_KP_PERIOD or event.key == pygame.K_COMMA:
                    logger.debug("Keypress 'r' or ',' or 'keypad .' detected")
                    return "resume_rotation"
                if event.key == pygame.K_p or event.key == pygame.K_KP_MULTIPLY:
                    logger.debug("Keypress 'p' or 'keypad *' detected")
                    return "pause_rotation"
                for numeric_key_counter, key in enumerate([pygame.K_F1,pygame.K_F2,pygame.K_F3,pygame.K_F4,pygame.K_F5,pygame.K_F6,pygame.K_F7,pygame.K_F8,pygame.K_F9,pygame.K_F10,pygame.K_F11,pygame.K_F12]):
                    if event.key == key:
                        logger.debug("Keypress 'F" + str(numeric_key_counter + 1) + "' detected")
                        return numeric_key_counter
                for numeric_key_counter, key in enumerate([pygame.K_KP0,pygame.K_KP1,pygame.K_KP2,pygame.K_KP3,pygame.K_KP4,pygame.K_KP5,pygame.K_KP6,pygame.K_KP7,pygame.K_KP8,pygame.K_KP9]):
                    if event.key == key:
                        logger.debug("Keypress 'keypad " + str(numeric_key_counter + 1) + "' detected")
                        return numeric_key_counter
                else:
                    return None
    except pygame.error as e:
        logger.debug("Exception " + repr(e))
        exit(0) 
开发者ID:SvenVD,项目名称:rpisurv,代码行数:31,代码来源:draw.py

示例2: process_events

# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_F11 [as 别名]
def process_events(self):
        clicked = False
        events = pygame.event.get()
        for event in events:
            # if the event is any type of quit request end the program
            if event.type == pygame.QUIT:
                quit()

            # resize the window if its requested
            elif event.type == pygame.VIDEORESIZE:
                self.window_size = event.size
                self.display_resize()

            # evaluate keypresses
            elif event.type == pygame.KEYDOWN:
                # exit on Escape
                if event.key == pygame.K_ESCAPE:
                    quit()
                # switch to fullscreen on F11
                elif event.key == pygame.K_F11:
                    self.fullscreen = not self.fullscreen

            # evaluate all presses of the left mousebutton
            elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
                clicked = True
                self.clicktime = pygame.time.get_ticks()
                self.clickEvent = event

        click = None
        timediff = pygame.time.get_ticks() - self.clicktime
        if clicked and self.await_dblclk == False and self.click is None:
            self.await_dblclk = True
            pass
        elif clicked and timediff < self.dblclktime and self.await_dblclk:
            click = "double"
            self.await_dblclk = False
        elif timediff > self.dblclktime and self.await_dblclk:
            click = "single"
            self.await_dblclk = False
        if click != None:
            self.await_dblclk = False
            self.clicktime = 0
            for element in self.elements:
                if hasattr(element, 'Callback') and element.Callback != None and element.Rect.collidepoint(self.clickEvent.pos):
                    if click == "double" and element.DblclkCallback != None:
                        element.DblclkCallback()
                    else:
                        element.Callback()

    # exit the programm 
开发者ID:ct-Open-Source,项目名称:ct-Raspi-Radiowecker,代码行数:52,代码来源:gui.py


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