本文整理汇总了Python中pygame.K_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Python pygame.K_DELETE属性的具体用法?Python pygame.K_DELETE怎么用?Python pygame.K_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pygame
的用法示例。
在下文中一共展示了pygame.K_DELETE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _map_keys
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_DELETE [as 别名]
def _map_keys(self):
key_map = self.io.key_map
key_map[imgui.KEY_TAB] = pygame.K_TAB
key_map[imgui.KEY_LEFT_ARROW] = pygame.K_LEFT
key_map[imgui.KEY_RIGHT_ARROW] = pygame.K_RIGHT
key_map[imgui.KEY_UP_ARROW] = pygame.K_UP
key_map[imgui.KEY_DOWN_ARROW] = pygame.K_DOWN
key_map[imgui.KEY_PAGE_UP] = pygame.K_PAGEUP
key_map[imgui.KEY_PAGE_DOWN] = pygame.K_PAGEDOWN
key_map[imgui.KEY_HOME] = pygame.K_HOME
key_map[imgui.KEY_END] = pygame.K_END
key_map[imgui.KEY_DELETE] = pygame.K_DELETE
key_map[imgui.KEY_BACKSPACE] = pygame.K_BACKSPACE
key_map[imgui.KEY_ENTER] = pygame.K_RETURN
key_map[imgui.KEY_ESCAPE] = pygame.K_ESCAPE
key_map[imgui.KEY_A] = pygame.K_a
key_map[imgui.KEY_C] = pygame.K_c
key_map[imgui.KEY_V] = pygame.K_v
key_map[imgui.KEY_X] = pygame.K_x
key_map[imgui.KEY_Y] = pygame.K_y
key_map[imgui.KEY_Z] = pygame.K_z
示例2: onKeyDown
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_DELETE [as 别名]
def onKeyDown(self, event):
if not self.select_item:
if event.type == pygame.KEYDOWN and event.key == pygame.K_DELETE:
pass
elif event.type == pygame.KEYDOWN and event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER and event.key != pygame.K_TAB:
lhv = len(self.value)
if event.key == pygame.K_BACKSPACE:
if lhv > 0:
if self.ls.lang.ltr_text:
self.value = self.value[0:lhv - 1]
else:
self.value = self.value[1:lhv]
else:
char = event.unicode
if len(char) > 0 and lhv < 21:
if self.ls.lang.ltr_text:
self.value = self.value + char
else:
self.value = char + self.value
if self.selection_modifier:
if self.ls.prev_user_checked:
if self.value != self.ls.prev_user_checked.value:
self.ls.prev_user_checked.update_me = True
self.ls.prev_user_checked.checked = False
self.ls.reload_selects()
self.ls.set_scrollbar_top(self.ls.scroll_min_top)
elif event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER or event.key == pygame.K_TAB:
self.nextFocus()
self.update_trigger()
示例3: test_widget_key_press
# 需要导入模块: import pygame [as 别名]
# 或者: from pygame import K_DELETE [as 别名]
def test_widget_key_press(widget):
"""
Test keypress widget.
:param widget: Widget object
:type widget: :py:class:`pygame_menu.widgets.core.widget.Widget`
"""
widget.update(PygameUtils.key(pygame.K_BACKSPACE, keydown=True))
widget.update(PygameUtils.key(pygame.K_DELETE, keydown=True))
widget.update(PygameUtils.key(pygame.K_LEFT, keydown=True))
widget.update(PygameUtils.key(pygame.K_RIGHT, keydown=True))
widget.update(PygameUtils.key(pygame.K_END, keydown=True))
widget.update(PygameUtils.key(pygame.K_HOME, keydown=True))