def slotLogin(self): if self.lineEdit.text() != 'admin': self.label_3.show() self.label_3.setText("密码错误!") else: self.hide() self.mainWindow = main_menu.MainMenu() self.mainWindow.reselect() self.mainWindow.show()
def main(): user32 = ctypes.windll.user32 # Get the width and height of the screen width = user32.GetSystemMetrics(0) height = user32.GetSystemMetrics(1) # Start the main menu menu = main_menu.MainMenu(width - 200, height - 100, 75, "./resources/tetris_background.jpg") menu.run()
def run(self): while self.running: self.menu_obj = main_menu.MainMenu(self.screen) self.menu_obj.run() if self.menu_obj.return_val == 1: self.game_obj = game.Game(self.screen) self.game_obj.run() if self.menu_obj.return_val == 2: self.help_obj = help_menu.HelpMenu(self.screen) self.help_obj.run() if self.menu_obj.return_val == 0: self.running = False
def __init__(self): ''' Instanciate CustomDBManager and Menu objects. If MySQL database is empty, instanciate OpenFoodFactsClient to retrieve data, then fill database. ''' self.db = custom_db_manager.CustomDBManager() self.main_menu = main_menu.MainMenu() self.menu = menu.Menu() if self.db.is_empty: self.off_client = openfoodfacts_client.OpenFoodFactsClient() self.db.reset_database(self.off_client.products)
def initMenus(self, menuEnable): self.menuOn = menuEnable self.optionsMenu = options.Options(self, self.game) self.mainMenu = main_menu.MainMenu(self, self.game) self.levelsMenu = main_menu.LevelsMenu(self, self.game) self.optionsMenu.disable() self.optionsMenuEnabled = False self.levelsMenu.disable() self.levelsMenuEnabled = False if not self.menuOn: self.mainMenuEnabled = False self.mainMenu.disable() else: self.mainMenuEnabled = True self.mainMenu.enable()
def login(self): login = self.user_login.text() password = self.user_pass.text() print('ВХОД', login, password) users_list = get_user_data() if login in users_list: if users_list[login] == password: self.close() with open('player_name.txt', 'w', encoding='utf8') as output_file: output_file.write(login) self.ex = main_menu.MainMenu() self.ex.show() return print('Нет такого аккаунта')
def loop(self): goto = "MainMenu" running = True while running: if goto == "MainMenu": goto = main_menu.MainMenu(self.window).loop() elif goto == "Singleplayer": goto = singleplayer_menu.SingleplayerMenu(self.window).loop() elif goto == "Multiplayer": goto = multiplayer_client.Multiplayer(self.window).loop() elif goto == "Map Editor": goto = map_editor.MapEditor(self.window).loop() elif goto == "Laboratory": goto = skilltree.SkilltreeMenu(self.window).skilltree_loop() elif goto == "Options": goto = options.OptionsMenu(self.window).loop() elif goto == "Quit": running = False
def __init__(self, language=None, reversed_btn=None): settings.MOVES_PER_SECOND = 2 reversed = False if reversed_btn is not None: reversed = reversed_btn.reversed self.game_exit = False # 0: main menu, 1: game, 2: gameover self.game_state = 0 self.prev_move = time.time() self.grid = [[False for j in range(settings.NUM_ROWS)] for i in range(settings.NUM_COLUMNS)] self.stats_collector = stats.Stats() self.language = language if language is not None: self.word_generator = words.WordGenerator(self.language, self.stats_collector, reversed) self.word, self.answer = "Temp", "Temp" self.apple_num = 3 self.apples = [] self.temp_apple = None self.temp_start = None if language is not None: self.grid[5][5] = True self.reset_apples() self.snake_obj = snake.Snake(self.word, self.grid) self.directions = [] self.game_over_screen = gameover.GameOver(self.stats_collector) self.main_menu_screen = main_menu.MainMenu() self.loading_screen = loading.Loading()
def keyPressEvent(self, event): if event.key() == Qt.Key_Space: self.close() self.main_menu = main_menu.MainMenu() self.main_menu.show()
def __init__(self): print("Object created") self.mainMenu = main_menu.MainMenu()
import sys sys.path.append('./Module') import base import main_menu import threading if __name__ == '__main__': device_num = base.get_device_num() if (len(device_num) == 0): print("\ndevices not exist, re-plug USB or reboot please") else: threading.Thread(target=base.is_exist).start() main_menu.MainMenu(main_menu.MainMenu.menu_array).run()
else: win.fill((200,200,200)) draw_grid(win,game.n,game.m,game.block_width) draw_rects(win,game) pygame.display.update() score_update(game,labels) master.update() pygame.display.quit() pygame.quit() run_main = True msg = "" while run_main: good = main_menu.MainMenu(msg) if good: init_data = main_menu.game_init_data try: netw = Network(init_data["ip"],init_data["port"]) dic = netw.send_recv(init_data) if (dic=="no_game"): msg = "No game by name '" + init_data["game"] + "'" print(msg) pass elif (dic=="occupied"): msg = "Game '" + init_data["game"] + "' full" print(msg) pass elif (dic=="socket_err"):