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