本文整理匯總了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))