我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用pygame.K_F5。
def toggle_show_fps(self, key): if key == pg.K_F5: self.show_fps = not self.show_fps if not self.show_fps: pg.display.set_caption(self.caption)
def toggle_show_fps(self, key): """Press f5 to turn on/off displaying the framerate in the caption.""" if key == pg.K_F5: self.show_fps = not self.show_fps if not self.show_fps: pg.display.set_caption(self.caption)
def _event_handler(self): for event in pygame.event.get(): if event.type == pygame.QUIT: self._running = False elif event.type == pygame.KEYDOWN: if event.key == pygame.K_q and pygame.key.get_mods() & pygame.KMOD_LCTRL: self._running = False elif event.key == pygame.K_F5: raise GameResetException() elif event.key == pygame.K_KP_PLUS: self._fps *= 2 elif event.key == pygame.K_KP_MINUS: self._fps = max(1,self._fps/2)