Python pygame.K_RETURN Examples
The following are 30
code examples of pygame.K_RETURN().
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: game093.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(-1, 0) elif active == 1: self.change_fract_btn(1, 0) elif active == 2: self.change_fract_btn(0, -1) elif active == 3: self.change_fract_btn(0, 1) elif 3 < active < 16: self.activate_factor(active-4) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset()
Example #2
Source File: game_functions.py From alien-invasion-game with MIT License | 6 votes |
def check_keydown_events(event: EventType, ai_settings: Settings , stats: GameStats, game_items: GameItems): """Respond when key is being pressed.""" if event.key == pygame.K_RIGHT: # Move ship to the right. game_items.ship.moving_right = True elif event.key == pygame.K_LEFT: # Move ship to the left. game_items.ship.moving_left = True elif event.key == pygame.K_SPACE: fire_bullet(ai_settings, game_items) elif event.key == pygame.K_q: quit_game(stats) elif event.key == pygame.K_RETURN: # ENTER key start_new_game(ai_settings, stats, game_items)
Example #3
Source File: battle_city_utils.py From AirGesture with MIT License | 6 votes |
def gameOverScreen(self): """ Show game over screen """ global screen # stop game main loop (if any) self.running = False screen.fill([0, 0, 0]) self.writeInBricks("game", [125, 140]) self.writeInBricks("over", [125, 220]) pygame.display.flip() while 1: time_passed = self.clock.tick(50) for event in pygame.event.get(): if event.type == pygame.QUIT: quit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: self.showMenu() return
Example #4
Source File: GameMenu.py From gamedev with MIT License | 6 votes |
def set_keyb_selection(self, key): # highlight menu item by key selection for item in self.items: # item.set_italic(False) item.set_color(self.color) if self.cur_item is None: self.cur_item = 0 else: if key == pygame.K_RETURN: self.go() elif key == pygame.K_UP: self.cur_item -= 1 elif key == pygame.K_DOWN: self.cur_item += 1 self.cur_item = self.cur_item % len(self.items) # self.items[self.cur_item].set_italic(True) self.items[self.cur_item].set_color(self.hcolor)
Example #5
Source File: demo_launcher.py From gamedev with MIT License | 6 votes |
def set_keyb_selection(self, key): # highlight menu item by key selection for item in self.items: # item.set_italic(False) item.set_color(self.color) if self.cur_item is None: self.cur_item = 0 else: if key == pygame.K_RETURN: self.go() elif key == pygame.K_UP: self.cur_item -= 1 elif key == pygame.K_DOWN: self.cur_item += 1 self.cur_item = self.cur_item % len(self.items) # self.items[self.cur_item].set_italic(True) self.items[self.cur_item].set_color(self.hcolor)
Example #6
Source File: game085.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if not self.show_msg: if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER): lhv = len(self.home_square.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 0: self.home_square.value = self.home_square.value[0:lhv - 1] else: char = event.unicode if len(char) > 0 and lhv < 3 and char in self.digits: self.home_square.value += char self.home_square.update_me = True self.mainloop.redraw_needed[0] = True self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() if event.type == pygame.MOUSEBUTTONDOWN: self.auto_check_reset()
Example #7
Source File: game115.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(self.numbers, -1, 0) elif active == 1: self.change_fract_btn(self.numbers, 1, 0) elif active == 2: self.change_fract_btn(self.numbers, 0, -1) elif active == 3: self.change_fract_btn(self.numbers, 0, 1) elif active == 4: self.change_fract_btn(self.numbers2, -1, 0) elif active == 5: self.change_fract_btn(self.numbers2, 1, 0) elif active == 6: self.change_fract_btn(self.numbers2, 0, -1) elif active == 7: self.change_fract_btn(self.numbers2, 0, 1) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset()
Example #8
Source File: pygame_functions.py From Pygame_Functions with GNU General Public License v2.0 | 6 votes |
def textBoxInput(textbox, functionToCall=None, args=[]): # starts grabbing key inputs, putting into textbox until enter pressed global keydict textbox.text = "" returnVal = None while True: updateDisplay() if functionToCall: returnVal = functionToCall(*args) for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: textbox.clear() if returnVal: return textbox.text, returnVal else: return textbox.text elif event.key == pygame.K_ESCAPE: pygame.quit() sys.exit() else: textbox.update(event) elif event.type == pygame.QUIT: pygame.quit() sys.exit()
Example #9
Source File: game031.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if not self.show_msg: if event.type == pygame.KEYDOWN and event.key != pygame.K_RETURN: lhv = len(self.home_square.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 0: self.home_square.value = self.home_square.value[0:lhv - 1] else: char = event.unicode if char in self.digits: if len(char) > 0 and lhv < self.max_len: self.home_square.value += char else: self.home_square.value = char self.home_square.update_me = True self.mainloop.redraw_needed[0] = True
Example #10
Source File: pygame_functions.py From Pygame_Functions with GNU General Public License v2.0 | 6 votes |
def textBoxInput(textbox, functionToCall=None, args=[]): # starts grabbing key inputs, putting into textbox until enter pressed global keydict textbox.text = "" returnVal = None while True: updateDisplay() if functionToCall: returnVal = functionToCall(*args) for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: textbox.clear() if returnVal: return textbox.text, returnVal else: return textbox.text elif event.key == pygame.K_ESCAPE: pygame.quit() sys.exit() else: textbox.update(event) elif event.type == pygame.QUIT: pygame.quit() sys.exit()
Example #11
Source File: game080.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if not self.show_msg: if event.type == pygame.KEYDOWN and event.key != pygame.K_RETURN: lhv = len(self.home_square.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 0: self.home_square.value = self.home_square.value[0:lhv - 1] else: char = event.unicode if char in self.digits: if len(char) > 0 and lhv < 2: self.home_square.value += char else: self.home_square.value = char self.home_square.update_me = True self.mainloop.redraw_needed[0] = True
Example #12
Source File: game034.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) if not self.show_msg: if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER): lhv = len(self.home_square.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 0: self.home_square.value = self.home_square.value[0:lhv - 1] elif not self.board.grid[4][16]: char = event.unicode if len(char) > 0 and char in self.digits: self.home_square.value = char self.home_square.update_me = True self.mainloop.redraw_needed[0] = True elif event.type == pygame.MOUSEMOTION and self.drag: if self.board.grid[4][16]: self.home_square.value = "" self.home_square.update_me = True elif event.type == pygame.MOUSEBUTTONUP: for each in self.board.units: if each.is_door is True: self.board.all_sprites_list.move_to_front(each) if self.board.grid[4][16]: self.home_square.value = "" self.home_square.update_me = True self.check_result() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() if event.type == pygame.MOUSEBUTTONDOWN: self.auto_check_reset() if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP: self.default_hover(event)
Example #13
Source File: game084.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) if not self.show_msg: if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER): lhv = len(self.home_square.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 0: self.home_square.value = self.home_square.value[0:lhv - 1] elif not self.board.grid[4][18]: char = event.unicode if len(char) > 0 and lhv < 2 and char in self.digits: self.home_square.value += char self.home_square.update_me = True self.mainloop.redraw_needed[0] = True elif event.type == pygame.MOUSEMOTION and self.drag: if self.board.grid[4][18]: self.home_square.value = "" self.home_square.update_me = True elif event.type == pygame.MOUSEBUTTONUP: for each in self.board.units: if each.is_door is True: self.board.all_sprites_list.move_to_front(each) if self.board.grid[4][18]: self.check_result() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() if event.type == pygame.MOUSEBUTTONDOWN: self.auto_check_reset() if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP: self.default_hover(event)
Example #14
Source File: game096.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(self.numbers, -1, 0) elif active == 1: self.change_fract_btn(self.numbers, 1, 0) elif active == 2: self.change_fract_btn(self.numbers, 0, -1) elif active == 3: self.change_fract_btn(self.numbers, 0, 1) elif active == 4: self.change_fract_btn(self.numbers2, -1, 0) elif active == 5: self.change_fract_btn(self.numbers2, 1, 0) elif active == 6: self.change_fract_btn(self.numbers2, 0, -1) elif active == 7: self.change_fract_btn(self.numbers2, 0, 1) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset()
Example #15
Source File: game097.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(self.numbers, -1, 0) elif active == 1: self.change_fract_btn(self.numbers, 1, 0) elif active == 2: self.change_fract_btn(self.numbers, 0, -1) elif active == 3: self.change_fract_btn(self.numbers, 0, 1) elif active == 4: self.change_fract_btn(self.numbers2, -1, 0) elif active == 5: self.change_fract_btn(self.numbers2, 1, 0) elif active == 6: self.change_fract_btn(self.numbers2, 0, -1) elif active == 7: self.change_fract_btn(self.numbers2, 0, 1) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset()
Example #16
Source File: game095.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(self.numbers, -1, 0) elif active == 1: self.change_fract_btn(self.numbers, 1, 0) elif active == 2: self.change_fract_btn(self.numbers, 0, -1) elif active == 3: self.change_fract_btn(self.numbers, 0, 1) elif active == 4: self.change_fract_btn(self.numbers2, -1, 0) elif active == 5: self.change_fract_btn(self.numbers2, 1, 0) elif active == 6: self.change_fract_btn(self.numbers2, 0, -1) elif active == 7: self.change_fract_btn(self.numbers2, 0, 1) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset()
Example #17
Source File: game118.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(self.numbers, -1, 0) elif active == 1: self.change_fract_btn(self.numbers, 1, 0) elif active == 2: self.change_fract_btn(self.numbers, 0, -1) elif active == 3: self.change_fract_btn(self.numbers, 0, 1) elif active == 4: self.change_fract_btn2(self.numbers2, -1, 0) elif active == 5: self.change_fract_btn2(self.numbers2, 1, 0) elif active == 6: self.change_fract_btn2(self.numbers2, 0, -1) elif active == 7: self.change_fract_btn2(self.numbers2, 0, 1) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset()
Example #18
Source File: game035.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) if not self.show_msg: if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER): lhv = len(self.home_square.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 0: self.home_square.value = self.home_square.value[0:lhv - 1] elif not self.board.grid[4][18]: char = event.unicode if len(char) > 0 and char in self.digits: self.home_square.value = char self.home_square.update_me = True self.mainloop.redraw_needed[0] = True elif event.type == pygame.MOUSEMOTION and self.drag: if self.board.grid[4][18]: self.home_square.value = "" self.home_square.update_me = True elif event.type == pygame.MOUSEBUTTONUP: for each in self.board.units: if each.is_door is True: self.board.all_sprites_list.move_to_front(each) if self.board.grid[4][18]: self.check_result() self.home_square.value = "" self.home_square.update_me = True elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() if event.type == pygame.MOUSEBUTTONDOWN: self.auto_check_reset() if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP: self.default_hover(event)
Example #19
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 #20
Source File: loginscreen.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def onKeyDown(self, event): if event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER: self.fsubmit() self.update_trigger()
Example #21
Source File: cli.py From stuntcat with GNU Lesser General Public License v2.1 | 5 votes |
def __pgbox(title, message): try: import pygame as pg pg.quit() #clean out anything running pg.display.init() pg.font.init() screen = pg.display.set_mode((460, 140)) pg.display.set_caption(title) font = pg.font.Font(None, 18) foreg, backg, liteg = (0, 0, 0), (180, 180, 180), (210, 210, 210) ok = font.render('Ok', 1, foreg, liteg) okbox = ok.get_rect().inflate(200, 10) okbox.centerx = screen.get_rect().centerx okbox.bottom = screen.get_rect().bottom - 10 screen.fill(backg) screen.fill(liteg, okbox) screen.blit(ok, okbox.inflate(-200, -10)) pos = [10, 10] for text in message.split('\n'): if text: msg = font.render(text, 1, foreg, backg) screen.blit(msg, pos) pos[1] += font.get_height() pg.display.flip() stopkeys = pg.K_ESCAPE, pg.K_SPACE, pg.K_RETURN, pg.K_KP_ENTER while 1: e = pg.event.wait() if e.type == pg.QUIT or \ (e.type == pg.KEYDOWN and e.key in stopkeys) or \ (e.type == pg.MOUSEBUTTONDOWN and okbox.collidepoint(e.pos)): break pg.quit() except pg.error: raise ImportError
Example #22
Source File: levels.py From The-Stolen-Crown-RPG with MIT License | 5 votes |
def check_for_menu(self, keys): """ Check if player hits enter to go to menu. """ if keys[pg.K_RETURN] and self.allow_input: if self.player.state == 'resting': self.state = 'menu' self.allow_input = False if not keys[pg.K_RETURN]: self.allow_input = True
Example #23
Source File: main.py From python-examples with MIT License | 5 votes |
def handle_event(self, event): if event.type == pygame.MOUSEBUTTONDOWN: self.active = self.rect.collidepoint(event.pos) self.color = self.color_active if self.active else self.color_inactive if event.type == pygame.KEYDOWN: if self.active: if event.key == pygame.K_RETURN: self.text = '' elif event.key == pygame.K_BACKSPACE: self.text = self.text[:-1] else: self.text += event.unicode
Example #24
Source File: key_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_name(self): self.assertEqual(pygame.key.name(pygame.K_RETURN), "return") self.assertEqual(pygame.key.name(pygame.K_0), "0") self.assertEqual(pygame.key.name(pygame.K_SPACE), "space")
Example #25
Source File: key_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_name(self): self.assertEqual(pygame.key.name(pygame.K_RETURN), "return") self.assertEqual(pygame.key.name(pygame.K_0), "0") self.assertEqual(pygame.key.name(pygame.K_SPACE), "space")
Example #26
Source File: key_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_name(self): self.assertEqual(pygame.key.name(pygame.K_RETURN), "return") self.assertEqual(pygame.key.name(pygame.K_0), "0") self.assertEqual(pygame.key.name(pygame.K_SPACE), "space")
Example #27
Source File: key_test.py From fxxkpython with GNU General Public License v3.0 | 5 votes |
def test_name(self): self.assertEqual(pygame.key.name(pygame.K_RETURN), "return") self.assertEqual(pygame.key.name(pygame.K_0), "0") self.assertEqual(pygame.key.name(pygame.K_SPACE), "space")
Example #28
Source File: game068.py From eduActiv8 with GNU General Public License v3.0 | 5 votes |
def handle(self, event): gd.BoardGame.handle(self, event) # send event handling up if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: active = self.board.active_ship if active == 0: self.change_fract_btn(-1) elif active == 1: self.change_fract_btn(1) self.auto_check_reset() elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER): self.check_result() elif event.type == pygame.KEYDOWN: self.auto_check_reset() lhv = len(self.nm1.value) self.changed_since_check = True if event.key == pygame.K_BACKSPACE: if lhv > 2: self.nm1.value = self.nm1.value[0:lhv - 1] else: char = event.unicode if len(char) > 0 and char in self.digits: self.numbers_disp[0] = int(char) self.nm1.set_value("0.%s" % char) self.check_result() self.nm1.update_me = True self.mainloop.redraw_needed[0] = True
Example #29
Source File: game.py From Games with MIT License | 5 votes |
def __startInterface(self): clock = pygame.time.Clock() while True: for event in pygame.event.get(): if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE): pygame.quit() sys.exit(-1) if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN: return self.screen.fill(self.cfg.AQUA) text1 = 'Press <Enter> to start the game' text2 = 'Press <Esc> to quit the game' text_render1 = self.font_big.render(text1, False, self.cfg.BLUE) text_render2 = self.font_big.render(text2, False, self.cfg.BLUE) self.screen.blit(text_render1, ((self.cfg.SCREENWIDTH-text_render1.get_rect().width)//2, (self.cfg.SCREENHEIGHT-text_render1.get_rect().height)//4)) self.screen.blit(text_render2, ((self.cfg.SCREENWIDTH-text_render2.get_rect().width)//2, (self.cfg.SCREENHEIGHT-text_render2.get_rect().height)//2)) pygame.display.flip() clock.tick(30)
Example #30
Source File: Game14.py From Games with MIT License | 5 votes |
def showText(screen, font, is_clearance, flag=False): clock = pygame.time.Clock() msg = 'Game Over!' if not is_clearance else 'Congratulations, you won!' positions = [[235, 233], [65, 303], [170, 333]] if not is_clearance else [[145, 233], [65, 303], [170, 333]] surface = pygame.Surface((400, 200)) surface.set_alpha(10) surface.fill((128, 128, 128)) screen.blit(surface, (100, 200)) texts = [font.render(msg, True, WHITE), font.render('Press ENTER to continue or play again.', True, WHITE), font.render('Press ESCAPE to quit.', True, WHITE)] while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() pygame.quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: if is_clearance: if not flag: return else: main(initialize()) else: main(initialize()) elif event.key == pygame.K_ESCAPE: sys.exit() pygame.quit() for idx, (text, position) in enumerate(zip(texts, positions)): screen.blit(text, position) pygame.display.flip() clock.tick(10)