Python pygame.K_k() Examples

The following are 3 code examples of pygame.K_k(). 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: video_looper.py    From pi_video_looper with GNU General Public License v2.0 10 votes vote down vote up
def _handle_keyboard_shortcuts(self):
        while self._running:
            event = pygame.event.wait()
            if event.type == pygame.KEYDOWN:
                # If pressed key is ESC quit program
                if event.key == pygame.K_ESCAPE:
                    self._print("ESC was pressed. quitting...")
                    self.quit()
                if event.key == pygame.K_k:
                    self._print("k was pressed. skipping...")
                    self._player.stop(3)
                if event.key == pygame.K_s:
                    if self._playbackStopped:
                        self._print("s was pressed. starting...")
                        self._playbackStopped = False
                    else:
                        self._print("s was pressed. stopping...")
                        self._playbackStopped = True
                        self._player.stop(3) 
Example #2
Source File: graphics.py    From highway-env with MIT License 5 votes vote down vote up
def handle_event(self, event: pygame.event.EventType) -> None:
        """
        Handle pygame events for moving and zooming in the displayed area.

        :param event: a pygame event
        """
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_l:
                self.scaling *= 1 / self.SCALING_FACTOR
            if event.key == pygame.K_o:
                self.scaling *= self.SCALING_FACTOR
            if event.key == pygame.K_m:
                self.centering_position[0] -= self.MOVING_FACTOR
            if event.key == pygame.K_k:
                self.centering_position[0] += self.MOVING_FACTOR 
Example #3
Source File: keys_def.py    From launcher with GNU General Public License v3.0 5 votes vote down vote up
def SetXYABButtons(mode):
    if mode == "snes":
        GameShell["Y"] = pygame.K_u
        GameShell["X"] = pygame.K_i
        GameShell["B"] = pygame.K_j
        GameShell["A"] = pygame.K_k
    else:
        GameShell["X"] = pygame.K_u
        GameShell["Y"] = pygame.K_i
        GameShell["A"] = pygame.K_j
        GameShell["B"] = pygame.K_k