本文整理汇总了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)
示例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 -----------------------------------------------------------------
# ==============================================================================
示例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 ------------------------------------------------------------
# ==============================================================================
示例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)
示例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 -----------------------------------------------------------------------
# ==============================================================================
示例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 -----------------------------------------------------------------------
# ==============================================================================
示例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)
示例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
示例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())