def run(self): running = True while running: screen.fill((0, 198, 255)) # clock.tick(120) for event in pg.event.get(): if event.type == pg.QUIT: quit() all_sprites.update(event) self.scrollbar.update(event) all_sprites.draw(screen) pg.display.flip() if self.btn_get_initial_menu.event[0]: event = self.btn_get_initial_menu.event running = False for btn_lvl in self.list_levels: if btn_lvl.event[0]: event = btn_lvl.event running = False try: if event[1] == 'initial_menu': from main.initial_menu import InitialMenu InitialMenu() elif event[1] == 'play': from main.playing import Play print(event[2]) Play(event[2]) elif event[1] == 'statistics': from main.statistics_menu import StatisticsMenu print(event) StatisticsMenu(event[2]) except BaseException: print('Ошибка:\n', traceback.format_exc())
def run(self): running = True while running: screen.fill((0, 198, 255)) clock.tick(60) for event in pg.event.get(): if event.type == pg.QUIT: quit() if event.type == pg.MOUSEBUTTONDOWN: all_sprites.update(event) all_sprites.draw(screen) pg.display.flip() if self.btn_get_lvl_menu.event[0]: event = self.btn_get_lvl_menu.event running = False elif self.button_your_account.event[0]: event = self.button_your_account.event running = False try: if event[1] == 'btn_get_lvl_menu': from main.level_menu import LevelMenu LevelMenu() if event[1] == 'btn_account': from main.account_menu import AccountMenu AccountMenu() except IndexError: import traceback print('Ошибка:\n', traceback.format_exc()) print('ошибка')
def run(self): running = True while running: screen.fill((0, 198, 255)) clock.tick(60) for event in pg.event.get(): if event.type == pg.QUIT: quit() if event.type == pg.MOUSEBUTTONDOWN: all_sprites.update(event) if event.type == pg.KEYDOWN and event.key == 114: running = False event = (0, 'btn_restart') if self.btn_get_lvl_menu.event[0]: event = self.btn_get_lvl_menu.event running = False elif self.btn_restart.event[0]: event = self.btn_restart.event running = False all_sprites.draw(screen) pg.display.flip() if event[1] == 'btn_get_lvl_menu': from main.level_menu import LevelMenu LevelMenu() elif event[1] == 'btn_restart': from main.playing import Play Play(self.level)
def run(self): screen.fill((0, 198, 255)) running = True while running: screen.fill((0, 198, 255)) clock.tick(60) for event in pg.event.get(): if event.type == pg.QUIT: quit() all_sprites.update(event) accounts_group.update(event) self.scrollbar.update(event) self.labels['label_status_new_account'].text = check_account( self.input_field.text)[0].split('\n') self.labels['label_status_new_account'].render_text() self.btn_create_new_account.name = self.input_field.text for btn_account in self.list_btns_account: btn_account[0].image_button() if btn_account[0].event[0]: if btn_account[0].event[1] == 'log_in': btn_account[0].log_in() btn_account[0].event = (False, ) elif btn_account[1].event[0]: if btn_account[1].event[1] == 'delete_account': btn_account[1].event = (False, ) self.update_accounts() if self.btn_create_new_account.event[0]: self.update_accounts() self.btn_create_new_account.event = (False, ) if self.btn_get_start_menu.event[0]: event = self.btn_get_start_menu.event running = False all_sprites.draw(screen) pg.display.flip() if event[1] == 'initial_menu': from main.initial_menu import InitialMenu InitialMenu()
def run(self): running = True while running: for event in pg.event.get(): if event.type == pg.QUIT: quit() all_sprites.update(event) self.scrollbar.update(event) screen.fill((0, 198, 255)) all_sprites.draw(screen) pg.display.flip() if self.btn_get_lvl_menu.event[0]: event = self.btn_get_lvl_menu.event running = False if self.check_box.event[0]: self.get_text() self.check_box.event = (False, ) if event[1] == 'btn_get_lvl_menu': from main.level_menu import LevelMenu LevelMenu()