def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path) if __name__ == "__main__": setting = Setting(resource_path("setting.config")) screen_resolution = setting.get_screen_resolution() grid = setting.get_grid() pygame.init() game_logic = GameLogic(Board(grid[0], grid[1]), setting.get_n()) game_logic.init() screen = pygame.display.set_mode(screen_resolution) cell_size = get_cell_size(screen_resolution[0], screen_resolution[1], game_logic.get_board().get_size()) game_loop(screen, cell_size, game_logic)