def ping(): # Pings an IP which is presented by the user. Calls the OS.System, and uses the command line utility ping import main_menu os.system("clear") print( "Please enter an IP address to ping (In the format of aaa.bbb.ccc.ddd)" ) ip = input("IP:- ") if checkip(ip): iterations = input( "How many ping iterations to carry out (Default: [4]):- ") try: if iterations == "": iterations = 4 else: iterations = int(iterations) os.system(f'ping -c {iterations} {ip}') print("") input("Please press enter to return to the main menu") main_menu.main_menu() except ValueError: print("Sorry, an integer hasn't been entered. Please try again.") time.sleep(1) ping() else: print("Sorry, IP address entered is incorrect. Please try again.") time.sleep(1) ping()
def again(self): _is_again = str(input("是否再次生成关键字?(Y/N):")) if _is_again == 'y' or _is_again == 'Y': print('\n\n') self.kw_generator_main() elif _is_again == 'n' or _is_again == 'N': main_menu.main_menu() else: _is_again = str(input("输入错误,请输入Y或N:"))
def historic(): mm.welcome_screen() print("\n\t\t\t\tGame Historic\n") # Print the historic for line in variables.historic_data[::-1]: print(line) input("\n\t\t\t\tPress Enter to continue") mm.main_menu()
def back_to_main_menu(**kwargs): r"""返回主菜单 :Keyword Arguments: enter_quit: 按回车返回 """ if kwargs.get('enter_quit', False): input('\n输入回车返回主菜单') os.system('cls') main_menu.main_menu() return 0
def adventure(): """ Principal gameflow """ # Show the main menu mm.main_menu() # Print the map after the main menu ma.map_printer() # Let the player move pa.player_actions("Actions Menu")
def again(self): _is_again = str(input("是否再次创建(Y/N):")) if _is_again == 'y' or _is_again == 'Y': self.main() elif _is_again == 'n' or _is_again == 'N': self.openfolder() main_menu.main_menu() else: print(self.invalid_input_msg) self.again()
def main(args): if not isfile(args) or not args.endswith('.db'): sys.exit( "Unable to open database, please check your path and make sure database file has file type with '.db'." ) conn = sqlite3.connect(args) while True: uid = loginPage(conn) if uid is not None: main_menu(uid, conn)
def docker_storage(): os.system("clear") while True: start.start() os.system("tput setaf 10") print(''' [1] CREATE VOLUME [2] VOLUME INFO [3] ATTACH VOLUME TO CONTAINER [4] SHOW VOLUMES [5] REMOVE VOLUMES [6] REMOVE ALL VOLUMES [0] BACK [99] EXIT ''') os.system("tput setaf 15") i=int(input("ENTER CHOICE : ")) if i==1: inp=input("VOLUME NAME : ") os.system(f"docker volume create {inp}") elif i==2: inp=input("VOLUME NAME : ") os.system(f"docker volume inspect {inp}") elif i==3: inp=input("CONTAINER NAME : ") inp1=input("VOLUME NAME : ") inp2=input("IMAGE NAME : ") inp3=input("ATTACH VOLUME TO ANY FOLDER (y/n) : ") if inp3.lower()[0]=='y': inp4=input("PATH TO FOLDER : ") os.system(f"docker run -it --name {inp} -v {inp1}:{inp4} {inp2}") elif inp3.lower()[0]=='': os.system("tput setaf 9 && echo 'OPTION NOT SELECTED' && tput setaf 15") else: os.system(f"docker run -it --name {inp} -v {inp1} {inp2}") elif i==4: os.system("docker volume ls") elif i==5: inp=input("VOLUME NAME : ") os.system(f"docker volume rm {inp}") elif i==6: os.system("docker volume prune") elif i==0: main_menu.main_menu() elif i==99: os.system("reset") exit() else: os.system("tput setaf 9 && echo -e 'OPTION NOT SUPPORTED !!!' && tput setaf 15") time.sleep(1) os.system("tput setaf 4") inp=input("enter to continue.......") os.system("tput setaf 15 && clear")
def docker_network(): os.system("clear") while True: start.start() os.system("tput setaf 10") print(''' [1] SHOW NETWORK [2] CREATE NETWORK [3] DISCONNECT NETWORK [4] RUN CONTAINER IN USERMADE NETWORK [5] INFO OF A NETWORK [6] REMOVE NETWORK [0] BACK [99] EXIT ''') os.system("tput setaf 15") i = int(input("CHOICE : ")) if i == 1: os.system("docker network ls") elif i == 2: inp = input("NETWORK NAME : ") inp1 = input("DRIVER NAME : ") inp2 = input("SUBNET RANGE : ") os.system( f"docker network create --driver {inp1} --subnet {inp2} {inp}") elif i == 3: inp = input("NETWORK NAME : ") inp1 = input("CONTAINER NAME : ") os.system(f"docker network disconnect {inp} {inp1}") elif i == 4: inp = input("CONTAINER NAME : ") inp1 = input("NETWORK NAME : ") inp2 = input("IMAGE NAME : ") os.system(f"docker run -it --name {inp} --network {inp1} {inp2}") elif i == 5: inp = input("NETWORK NAME : ") os.system(f"docker network inspect {inp}") elif i == 6: inp = input("NETWORK NAME : ") os.system(f"docker network rm {inp}") elif i == 0: main_menu.main_menu() elif i == 99: os.system("reset") exit() else: os.system( "tput setaf 9 && echo -e 'OPTION NOT SUPPORTED !!!' && tput setaf 15" ) time.sleep(1) os.system("tput setaf 4") inp = input("enter to continue.......") os.system("tput setaf 15 && clear")
def leaderboard(): mm.welcome_screen() print("\n\t\t\t\tThis is the leaderboard\n") # Sort the list variables.leaderboard_data.sort(reverse=True) # Print the leaderboard for line in variables.leaderboard_data: print( f"Score : {line[0]} Name : {line[1]} Energy : {line[2]} Hydratation : {line[3]} Satiety : {line[4]} Movements : {line[5]} Actions : {line[6]} Time : {line[7]} seconds\n" ) input("\n\t\t\t\tPress Enter to continue") mm.main_menu()
def get_ui(self, indexed_kw_types: dict): self.ui_kw = str(input("请选择需要操作的关键词(0:打开关键词文件,-1退出):")) if self.ui_kw == str(0): os.startfile(KWu.PATH_DATA_BASE) main_menu.main_menu() elif self.ui_kw == str(-1): main_menu.main_menu() else: self.ui_kw = indexed_kw_types[int(self.ui_kw)] self.how_many_to_keep = int(input("需要保留前几位的关键词?:")) if type(self.how_many_to_keep) != int: print("输入错误,需要输入正整数数字") self.how_many_to_keep = int(input("需要保留前几位的关键词?:")) self._out_keywords_path = \ KWu.find_storage_path() +\ f'\\关键词文件_{self.ui_kw}_{str(datetime.datetime.now()).replace(":", "_").replace(".", "_")}.txt '
def process_events(self,screen): """ Handles the event processing in the game """ for event in pygame.event.get(): if((event.type == pygame.QUIT) or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE)): pause_menu = mm.main_menu(screen, ['Resume','Credits', 'Quit Game'], 150, 40, 0.7, COLOR_BLUE) if(pause_menu == 1): showing_creds = True show_creds(screen) if(pause_menu == 2): pygame.quit() if(event.type == pygame.KEYDOWN): if(event.key == pygame.K_RIGHT): if((self.STATE_GAME_OVER == False) or (self.STATE_GAME_WON == False)): self.player.move_right() if(event.key == pygame.K_LEFT): if((self.STATE_GAME_OVER == False) or (self.STATE_GAME_WON == False)): self.player.move_left() if(event.key == pygame.K_SPACE): if((self.STATE_GAME_OVER) and (self.STATE_BALL_IN_PADDLE)): self.__init__(1) if(event.key == pygame.K_SPACE): if(self.STATE_BALL_IN_PADDLE): self.STATE_BALL_IN_PADDLE = False self.STATE_BEGIN_PLAYING = True self.ball.ball_vel = self.ball.ball_vel if((event.key == pygame.K_KP_ENTER) or (event.key == pygame.K_RETURN)): if(self.STATE_GAME_WON): self.__init__(self.level + 1) return False
def main(): if check_and_inform_window_size() == "return": return while True: # Global gamestate and gameaction instances gs = gamestate.GameState() ga = gameaction.GameAction(gs) main_menu.clear_screen() main_menu_choice = main_menu.main_menu() if main_menu_choice == 1: game_play.game_play(ga) elif main_menu_choice == 2: main_menu.clear_screen() ga, load_menu_choice = load_save_menu.load_game(ga) if load_menu_choice == 4: continue game_play.game_play(ga) elif main_menu_choice == 3: # insert confirmation check main_menu.clear_screen() exit_choice = main_menu.exit_game_confirmation() if exit_choice == 2: # 1 == exit, 2 == stay continue sys.stdout.write("\033[K") # clear line print("\nThanks for playing! Good-bye!") input("\nPress [Enter] to continue...\n") break
def main(): command = 0 # start value for while while command != '6': print("\nWelcome to the Security System") print("1 - Get camera data.") print("2 - Get last camera photo.") print("3 - Get all aren't same types of cameras.") print("4 - Calculate degrees.") print("5 - Get cameras with a same names.") print("6 - Exit.") command = input("Write here command number:>> ") if (command != '6'): main_menu(command) else: print("\n\n--------------------------------") print("Thank you for using our program.") print("--------------------------------")
def load_game(): # Check if the save file exist at that location if os.path.isfile("maps/saved_map.txt") and os.path.isfile( "save/data_save.json"): # Save file exist # Load saved map ma.saved_map() # Load Saved data load_data() # Load the historic lb.load_historic() # Get the starting time variables.time_data["start time"] = round(time.time()) else: # Save fil doesn't exist print("\n\t\t\tNo save file") # Wait for 3 seconds sleep(3) # Return to the menu mm.main_menu()
def make_offer(body, peer_id, code): message = vkMessage('') if body.lower() == 'коллективная жалоба': url = vkapi.get_messages_upload_server(peer_id) request = get_request(url) req = request.text.split('":"')[1][0:-2] answer = get_answer(req) message = set_message(answer, peer_id) message.send() message = MM.main_menu() return message
def update_orders(id, orders): query = update_template('Orders') args = (orders, id) DB.insert_data(query, args) code = 9 DB.set_state(id, code) update_date(id) SendToPredsed.prepare_doc(id) message = MM.main_menu( 'Ваша жалоба успешно отправлена!\nОжидайте рассмотрения.') return message
def run(self, already_run): """Begin running the game""" if (not already_run): the_menu = main_menu(self) the_menu.run(self.screen) self.clock.tick() while self.dont_exit: self.handle_events() self.update() self.draw() pygame.display.flip() self.time_since_last_frame = float(self.clock.tick(60))
def make_offer(offer, peer_id, code): chairman = get_chairman_id(DB.get_faculty(peer_id)) destinations = ['21766756','285623077'] if chairman and not chairman in '-': destinations.append(str(chairman)) def send(destination_id): message = vkMessage(("Предложение от @id%s\n" % (peer_id)) + str(offer)) message.peer_id = message.user_id = destination_id message.send() for id in destinations: send(id) DB.set_state(peer_id, 9) return MM.main_menu('Ваше сообщение было успешно отправлен Студенческому совету!\nОжидайте ответа от вашего председателя!')
def make_offer(body, peer_id, code): message = vkMessage('') if code == '9' and body.lower() == 'обратная связь': message.message = DB.get_state_help(10) message.keyboard = cancel_keyboard() DB.set_state(peer_id, 10) elif code in ['10']: if body.lower() == 'отмена': message = MM.main_menu() DB.set_state(peer_id, 9) else: message = state_list[code](body, peer_id, code) return message
def choose_event(body, id, code, attachments): message = vkMessage('') if body in 'Меню': DB.set_state(id, 9) message = MM.main_menu() return message events = DB.get_events() for event in events: if body in event: DB.set_state(id, event[0]) state = DB.full_state_info(event[0]) message = event_menu_template(state, state[1]) return message
def login_valid( client): #for authentication purpose i.e. valid user name and password client.send("Enter your email address:~") usr_mail = recv_fun(client) usr_mail = usr_mail.rstrip() client.send("Enter your password:~") u_pass = recv_fun(client) u_pass = u_pass.rstrip() fh = open('user_email.txt', 'r') x = fh.readlines() fh.close() temp = usr_mail + "\n" if temp in x: #if user name is valid client.send("1~") a = x.index(temp) fh = open('user_pass.txt', 'r') y = fh.readlines() fh.close() fh = open('user_name.txt', 'r') p = fh.readlines() fh.close() u_name = p[a].rstrip() temp = u_pass + "\n" if y[a] == temp: #if password is matched client.send("1~") client.send("Login Successful..~") main_menu( client, u_name, u_pass ) #authentication done. calling to main_menu() which is in main_menu.py file else: client.send("0~") #password doesn't match client.send("Sorry wrong Password...Please try again..\n~") login_valid(client) #calling itself else: #invalid username client.send("0~") client.send("This email is not registered with us..~") login_valid(client) #calling itself
def main(): pygame.init() global clock screen = pygame.display.set_mode([SCREEN_WIDTH, SCREEN_HEIGHT]) # -- CREDITS main_menu = mm.main_menu(screen, ['Start Game', 'Credits', 'Quit Game'], 150, 40, 0.7, COLOR_BLUE) pygame.display.set_caption("My Ice Breaker") done = False clock = pygame.time.Clock() pygame.key.set_repeat(10,10) game = None if(main_menu == 0): game = Game(1) if(main_menu == 1): show_creds(screen) showing_creds = True elif(main_menu == 2): pygame.quit() background = pygame.image.load('Includes/Images/background.png') while not done: if(game != None): done = game.process_events(screen) if(game != None): game.run_logic(screen) screen.blit(background,[0,0]) if(game != None): game.display_frame(screen) clock.tick(60) if game == None: for event in pygame.event.get(): if((event.type == pygame.QUIT) or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE)): showing_creds = False main() pygame.quit()
def update_phone(id, phone, code): phone = normalizer(phone) query = update_template('Phone') code = 5 args = (phone, code, id) DB.insert_data(query, args) DB.set_state(id, '9') person = DB.get_person(id) if person[7]: try: DB.set_state(id, person[7]) DB.set_after_reg(id, '') return Events.events_main("Что это такое?", id, person[7], []) except Exception as e: raise e return MM.main_menu()
def app(): start_point = main_menu.main_menu() if start_point == "bracket": player_count = validation_helpers.player_count_validation() champ_count = validation_helpers.champion_count_validation() bracket_generator.get_players(player_count, champ_count) bracket = file_io.load_bracket() while len(bracket) > 0: for number in range(len(bracket)): match_number = number + 1 gui_generator.match_builder(match_number, bracket['match_%s' % match_number]) print('Good Luck summoners\n\n') bracket_generator.round_complete(bracket, champ_count) bracket = file_io.load_bracket() elif start_point == "bans": global_bans.ban_menu()
def main(): # Try and load the game music try: pygame.mixer.init() pygame.mixer.music.load('../audio/menu-audio.ogg') pygame.mixer.music.play(-1) except: raise UserWarning, "could not load background music" # Create an instance of the main menu and then run its loop main = main_menu.main_menu() main.menu_loop(screen, width, height) # Once the main menu exits, that means the game has started game_loop(screen) pygame.quit()
def show_menu (self, a, b): menu = main_menu.main_menu (a, b) # -- open the menu adonthell.gamedata_engine ().main (menu, "game_menu") # -- once the menu is closed, see what we got retval = menu.get_result () # -- start new game if retval == 1: # -- let the player chose a name for his character import character_screen cs = character_screen.character_screen () adonthell.gamedata_engine ().main (cs, "character_screen") adonthell.gamedata_engine ().fade_out () self.cleanup () # -- load the initial game adonthell.gamedata_load (0) adonthell.gamedata_player ().set_name (cs.name) # -- on to the intro self.play_intro () # -- Load game elif retval == 2: adonthell.gamedata_player ().set_schedule_active (1) self.window.set_visible (0) self.cleanup () adonthell.gamedata_engine ().mapview_start () adonthell.gamedata_engine ().set_control_active (1) adonthell.gamedata_engine ().fade_in () # -- quit the game else: adonthell.gamedata_engine ().main_quit () adonthell.win_container.__del__ (menu)
def show_menu(self, a, b): menu = main_menu.main_menu(a, b) # -- open the menu adonthell.gamedata_engine().main(menu, "game_menu") # -- once the menu is closed, see what we got retval = menu.get_result() # -- start new game if retval == 1: # -- let the player chose a name for his character import character_screen cs = character_screen.character_screen() adonthell.gamedata_engine().main(cs, "character_screen") adonthell.gamedata_engine().fade_out() self.cleanup() # -- load the initial game adonthell.gamedata_load(0) adonthell.gamedata_player().set_name(cs.name) # -- on to the intro self.play_intro() # -- Load game elif retval == 2: adonthell.gamedata_player().set_schedule_active(1) self.window.set_visible(0) self.cleanup() adonthell.gamedata_engine().mapview_start() adonthell.gamedata_engine().set_control_active(1) adonthell.gamedata_engine().fade_in() # -- quit the game else: adonthell.gamedata_engine().main_quit() adonthell.win_container.__del__(menu)
def on_event(self, event): if self.choice_overlay is not None: if event.type == pygame.KEYUP or event.type == pygame.KEYDOWN: self.choice_overlay.on_key(event) elif event.type == pygame.MOUSEMOTION: r_x = event.pos[0] - self.choice_overlay.x r_y = event.pos[1] - self.choice_overlay.y if self.choice_overlay.contains(r_x, r_y): self.choice_overlay.on_mouse_over(r_x, r_y) elif event.type == pygame.MOUSEBUTTONUP: r_x = event.pos[0] - self.choice_overlay.x r_y = event.pos[1] - self.choice_overlay.y if self.choice_overlay.contains(r_x, r_y): self.choice_overlay.on_click(event.button, r_x, r_y) else: gui.gui_state.on_event(self, event) if event.type == pygame.QUIT: import main_menu state = main_menu.main_menu() self.viewport.push(state)
def get_answer(body): message = vkMessage('') try: code = str(DB.get_current_state(body['from_id'])) except Exception as e: message = say_hello(body['text']) if message.message: return message code = '0' query = """INSERT INTO Persons(VK, Status) VALUES(%s,%s)""" args = (body['from_id'], 0) DB.insert_data(query, args) events = DB.get_events() for event in events: if body['text'].lower() in event[2].lower(): DB.set_after_reg(body['from_id'], event[0]) body['text'] = 'Регистрация' if code == '0': message = say_hello(body['text']) if message.message: return message if "Events" in code: return events_main(body['text'], body['from_id'], code, body['attachments']) if code == '9' and body['text'] == 'Мероприятия': return events_main(body['text'], body['from_id'], code, body['attachments']) for module in command_list: if code in module.keys: message = module.process(body['text'], body['from_id'], code) if message.not_empty(): break if code == '9' and message.message == "": message = MM.main_menu() return message
def run(self): self.gameSounds.playmenu(True,1.0) scr_menu = main_menu.main_menu(self.parameters) scr_menu.setScreen(self.screen,30) scr_menu.constructScene() ret = 0 while True: if(ret == 0): ret = scr_menu.run() if(ret == 1): self.gameSounds.playmenu(False,1.0) print("LET'S PLAY FMM!!") scr_game = game_engine.gameEngine(self.parameters,self.gameSounds) print('in game!!') gummworld2.run(scr_game) print('out of game!!') ret = 0 self.gameSounds.playmenu(True,1.0) else: self.gameSounds.playmenu(False,1.0) print("EXITING FMM!!") pygame.quit() sys.exit()
def back(self, src): from main_menu import main_menu state = main_menu() self.viewport.push(state)
#Jakub Dolezal V2C #importy import nastaveni import main_menu import nastaveni_menu import logika main_menu.main_menu() #otevre main_menu.py - hlavni menu #logika.Logika()
# --------------------- MAIN PROGRAM -------------------- # Initialize mixer before pg to avoid audio lag pg.mixer.pre_init(44100, -16, 2, 512) pg.mixer.init() pg.init() # Window setup screen = pg.display.set_mode(res) # Title and icon pg.display.set_caption("Gotta Catch E'lon") icon = pg.image.load(get_folder_file("Images", "icon.png")) pg.display.set_icon(icon) # Font pg.font.init() main_font = get_folder_file("Images", "retro-sans.ttf") # Music audiovolume = 100 # volume from 0-100 % # Play game glob_run, skip_intro = intro_story( screen, scr_w, scr_h, audiovolume, scale_factor) # avoid nameclash global_running main_menu(high_score, glob_run, skip_intro, rocket_rects_lock, rocket_imgs_lock, rocketimgs, rocketrects, screen, scr_w, scr_h, audiovolume, scale_factor) pg.quit()
FPS = 60 pygame.init() size = width, height = 800, 600 screen = pygame.display.set_mode(size) running = True # подключаем музыку tetris_sound = pygame.mixer.Sound('data/music/tetris.mp3') dinosaur_sound = pygame.mixer.Sound('data/music/dinosaur.mp3') end_sound = pygame.mixer.Sound('data/music/end.mp3') while running: pygame.display.set_caption("Главное меню") # запускаем меню game = main_menu(screen) # запускаем игру по запросу if game == 'Tetris': while True: pygame.display.set_caption("Тетрис") tetris_sound.play(loops=-1) # запускаем заставку result = tetris(screen) tetris_sound.stop() end_sound.play() event = tetris_end(*result) pygame.display.set_caption("Конец игры") if event == 'Menu': break else: while True:
def start_menu(self): self.okno.destroy() main_menu.main_menu()
def activate_menu(self): m = main_menu(self) m.run(self.screen) if (m.restart_game): self.dont_exit = False
def back(self, src): import main_menu state = main_menu.main_menu() self.viewport.push(state)
def __init__(self): # pygame init() init() #mixer.init() # Obj utils self.u = game_utils() self.d = driver() self.s = scene(self) self.p = page(self) # self.debug = game_debug(self) # display initialized. self.screen_size = 800, 600 self.screen = display.set_mode(self.screen_size) self.main_title = 'Worm Jumping' self.set_display() # load image self.playarea_image = self.u.load_image('S-3-800x600.png') self.playinfo_image = self.u.load_image('S-3-200x600.png') self.dancing_block_image = self.u.load_image('dancingblock.png', -1) self.key_dancing_image = self.u.load_image('keydancing.png', -1) self.cow_logo_image = self.u.load_image('mgamelogo.png', -1) self.menu_background_image = self.u.load_image('menu_background.png') self.menu_background2_image = self.u.load_image('menu_background2.png') # load sound self.knock_sounds = [ self.u.load_sound('humanbomb.ogg'), self.u.load_sound('shotb.ogg'), self.u.load_sound('laserrocket.ogg') ] self.click_sounds = [ self.u.load_sound('click_1d.ogg'), self.u.load_sound('click_h1.ogg'), self.u.load_sound('clickverb.ogg') ] self.page_sounds = [ self.u.load_sound('book_page_f2.ogg'), self.u.load_sound('book_page_s.ogg'), self.u.load_sound('book_page_f.ogg'), self.u.load_sound('book_page_s2.ogg') ] # load fonts self.game_info_font = font.Font(self.u.load_font('graffiti.ttf'), 36) self.menu_info_font = font.Font(self.u.load_font('graffiti.ttf'), 24) self.game_info_small_font = font.Font(self.u.load_font('station.ttf'), 18) self.sys_font = font.Font(None, 56) # load music self.u.play_music('coco.ogg') # Sprite Group init self.spider_group = sprite.Group() self.block_group = sprite.Group() self.groundblock_group = sprite.Group() self.menu_group = sprite.Group() self.init_base_int() # Set this value for test configure menu. self.config_speed = 170.00 self.config_max = 170.00 self.config_keep = 170.00 self.config_music = 170.00 # page int set. self.NEW_GAME_PAGE = -1 self.GAME_PAGE = 1 self.CONFIGURE_PAGE = 2 self.QUIT_PAGE = 3 self.MAIN_PAGE = 4 # init menus Obj. self.m_m = main_menu(self, self.s.menu_s, self.menu_background_image) self.c_m = configure_menu(self, self.s.menu_s, self.menu_background_image) self.p_m = playing_menu(self, self.s.menu_s, self.menu_background_image) self.c_g_m = configure_game_menu(self, self.s.menu_choicebar_s, self.menu_background2_image) # self.choicebar = choicebar(self, self.s.menu_choicebar_s) self.m_list = []
elif arg == '-h' or arg == '--height': i += 1 if i < nargs: height = int(sys.argv[i]) elif arg == '-r' or arg == 'resolution': i += 1 if i < nargs: res = sys.argv[i] data = res.split('x') if len(data) == 2: width = int(data[0]) height = int(data[1]) elif arg == '-d' or arg == '--debug': logger.set_output_level(logger.logger.Debug) print "Debug Output, Have fun !" elif arg == '-v' or arg == '--verbose': logger.set_output_level(logger.logger.Verbose) i += 1 print "Python Deck Building Game" print "Opening window [%dx%d]" % (width, height) style = gui.get_style() viewport = gui.create_viewport(width, height) state = main_menu.main_menu() viewport.push(state)
def quit_game(self, src): import main_menu state = main_menu.main_menu() self.viewport.push(state)
def exit(self): self.thread.cancel() #Ukonceni aplikace self.okno.destroy() main_menu.main_menu()
def run (self): # -- bring up the main menu if input_has_been_pushed (SDLK_ESCAPE): import main_menu # -- create main menu without animation, # with saving and background enabled menu = main_menu.main_menu (1, 1, 1) # -- Stop updating the player gamedata_player ().set_schedule_active (0) gamedata_engine ().set_control_active (0) # -- open the main menu gamedata_engine ().main (menu, "game_menu") # -- main menu closed -> see what to do if menu.get_result () == 5: # -- quit the game gamedata_engine ().main_quit () else: # -- continue gamedata_player ().set_schedule_active (1) gamedata_engine ().set_control_active (1) win_container.__del__ (menu) # -- shortcut to the load screen elif input_has_been_pushed (SDLK_l): s = data_screen (LOAD_SCREEN) s.set_activate (1) # -- Stop updating the player gamedata_player ().set_schedule_active (0) gamedata_engine ().set_control_active (0) # -- open the load screen gamedata_engine ().main (s, "load_screen") # -- continue gamedata_player ().set_schedule_active (1) gamedata_engine ().set_control_active (1) # -- and to the save screen elif input_has_been_pushed (SDLK_s): s = data_screen (SAVE_SCREEN) s.set_activate (1) # -- Stop updating the player gamedata_player ().set_schedule_active (0) gamedata_engine ().set_control_active (0) # -- open the save screen gamedata_engine ().main (s, "save_screen") # -- continue gamedata_player ().set_schedule_active (1) gamedata_engine ().set_control_active (1) # -- python console elif input_has_been_pushed (SDLK_TAB): import console c = console.console (globals ()) c.set_activate (1) # -- Stop updating the player gamedata_player ().set_schedule_active (0) gamedata_engine ().set_control_active (0) # -- open the console gamedata_engine ().main (c, "console") # -- continue gamedata_player ().set_schedule_active (1) gamedata_engine ().set_control_active (1)