Python pygame.K_DELETE Examples
The following are 3
code examples of pygame.K_DELETE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygame
, or try the search function
.
Example #1
Source File: pygame.py From pyimgui with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #2
Source File: loginscreen.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
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()
Example #3
Source File: _utils.py From pygame-menu with MIT License | 5 votes |
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))