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


Python locals.K_RETURN属性代码示例

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


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

示例1: key_down

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_RETURN [as 别名]
def key_down(self, event):
        k = event.key
        #print "Widget.key_down:", k ###
        if k == K_RETURN or k == K_KP_ENTER:
            if self.enter_response is not None:
                self.dismiss(self.enter_response)
                return
        elif k == K_ESCAPE:
            self.root.fix_sticky_ctrl()
            if self.cancel_response is not None:
                self.dismiss(self.cancel_response)
                return
        elif k == K_TAB:
            self.tab_to_next()
            return
        self.call_parent_handler('key_down', event) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:18,代码来源:widget.py

示例2: handle_events

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_RETURN [as 别名]
def handle_events(self):
        """
        Obsługa zdarzeń systemowych, tutaj zinterpretujemy np. ruchy myszką

        :return True jeżeli pygame przekazał zdarzenie wyjścia z gry
        """
        for event in pygame.event.get():
            if event.type == pygame.locals.QUIT:
                pygame.quit()
                return True

            from pygame.locals import MOUSEMOTION, MOUSEBUTTONDOWN
            if event.type == MOUSEMOTION or event.type == MOUSEBUTTONDOWN:
                self.population.handle_mouse()

            from pygame.locals import KEYDOWN, K_RETURN
            if event.type == KEYDOWN and event.key == K_RETURN:
                self.started = True


# magiczne liczby używane do określenia czy komórka jest żywa 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:23,代码来源:code3.py

示例3: key_down

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_RETURN [as 别名]
def key_down(self, event):
        """Handles key press.
        Captured events are ENTER and SPACE key press.
        :param event: object: The event being processed."""
        key = event.key
        if key in (K_RETURN, K_KP_ENTER, K_SPACE):
            self.call_handler("action")
        else:
            Widget.key_down(self, event) 
开发者ID:Podshot,项目名称:MCEdit-Unified,代码行数:11,代码来源:controls.py


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