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


Python locals.K_ESCAPE属性代码示例

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


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

示例1: key_down

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [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: _is_quit_shortcut

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def _is_quit_shortcut(key):
        return (key == K_ESCAPE) or (key == K_q and pygame.key.get_mods() & KMOD_CTRL)


# ==============================================================================
# -- HUD -----------------------------------------------------------------
# ============================================================================== 
开发者ID:felipecode,项目名称:coiltraine,代码行数:9,代码来源:carla08interface.py

示例3: _is_quit_shortcut

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def _is_quit_shortcut(key):
        return (key == K_ESCAPE) or (key == K_q and pygame.key.get_mods() & KMOD_CTRL)


# ==============================================================================
# -- Global Objects ------------------------------------------------------------
# ============================================================================== 
开发者ID:carla-simulator,项目名称:scenario_runner,代码行数:9,代码来源:no_rendering_mode.py

示例4: _is_quit_shortcut

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def _is_quit_shortcut(key):
        return (key == K_ESCAPE) or (key == K_q and pygame.key.get_mods() & KMOD_CTRL) 
开发者ID:felipecode,项目名称:coiltraine,代码行数:4,代码来源:carla09interface.py

示例5: _is_quit_shortcut

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def _is_quit_shortcut(key):
        return (key == K_ESCAPE) or (key == K_q and pygame.key.get_mods() & KMOD_CTRL)


# ==============================================================================
# -- HUD -----------------------------------------------------------------------
# ============================================================================== 
开发者ID:praveen-palanisamy,项目名称:macad-gym,代码行数:9,代码来源:manual_control.py

示例6: _is_quit_shortcut

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def _is_quit_shortcut(key):
        return (key == K_ESCAPE) or (key == K_q
                                     and pygame.key.get_mods() & KMOD_CTRL)


# ==============================================================================
# -- HUD -----------------------------------------------------------------------
# ============================================================================== 
开发者ID:praveen-palanisamy,项目名称:macad-gym,代码行数:10,代码来源:spawn_control.py

示例7: _is_quit_shortcut

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def _is_quit_shortcut(key):
        return (key == K_ESCAPE) or (key == K_q
                                     and pygame.key.get_mods() & KMOD_CTRL) 
开发者ID:praveen-palanisamy,项目名称:macad-gym,代码行数:5,代码来源:keyboard_control.py

示例8: input

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def input(events):
    for event in events:  # Hit the ESC key to quit the slideshow.
        if (event.type == QUIT or
            (event.type == KEYDOWN and event.key == K_ESCAPE)):
            pygame.quit()
                
#delete files in folder 
开发者ID:drumminhands,项目名称:drumminhands_photobooth,代码行数:9,代码来源:drumminhands_photobooth.py

示例9: update

# 需要导入模块: from pygame import locals [as 别名]
# 或者: from pygame.locals import K_ESCAPE [as 别名]
def update(self):
        """Called on new frame."""
        self.clock.tick(60)
        new_time = time.time()
        self.time_delta = new_time - self.last_update_time
        self.last_update_time = new_time
        self.score += self.energy_per_second * self.time_delta
        for event in pygame.event.get():
            if event.type == QUIT or (event.type == KEYDOWN
                                      and event.key == K_ESCAPE):
                self.exit_requested = True
                return
            if event.type == MOUSEBUTTONDOWN:
                pos = pygame.mouse.get_pos()
                if self.crank.rect.collidepoint(pos):
                    self.crank.clicked()
                for button in self.all_buttons:
                    if button.rect.collidepoint(pos):
                        button.clicked()
                for machine in self.machines.values():
                    if machine.rect.collidepoint(pos):
                        if self.score >= machine.cost:
                            self.score -= machine.cost
                            machine.count += 1
                            self.events.send(f"buy_machine_{machine.name}")

        if self.score >= 5.67e5 and not self.congrats_message:
            self.congrats_message = StaticImage((0.5, 0.8), images["congrats"])
            self.gui_plain.add(self.congrats_message)
            self.events.send("win")

        for sprite_layer in self.sprite_layers:
            sprite_layer.update()
        self.screen.blit(self.background, (0, 0))
        self.screen.fill(self.overlay_color, rect=self.overlay1, special_flags=pygame.BLEND_MULT)
        self.screen.fill(self.overlay_color, rect=self.overlay2, special_flags=pygame.BLEND_MULT)
        for sprite_layer in self.sprite_layers:
            sprite_layer.draw(self.screen)
        pygame.display.flip()
        say(self.events.get_current_message()) 
开发者ID:python-discord,项目名称:code-jam-5,代码行数:42,代码来源:__main__.py


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