def setup(): # get the user's config settings from config.ini config = ConfigParser() path = os.path.join(sys.path[0][0:-4], "config.ini") config.read(path) cfg = config["CUSTOM VARIABLES"] cols = int(cfg["cols"]) rows = int(cfg["rows"]) cell_size = int(cfg["cell_size"]) update_interval = float(cfg["update_interval"]) starter_cells_blueprint = int(cfg["starter_cells_blueprint"]) random_starter_cells = cfg.getboolean("random_starter_cells") fullscreen_bool = cfg.getboolean("fullscreen_bool") draw_debug_info_bool = cfg.getboolean("draw_debug_info_bool") draw_cells_bool = cfg.getboolean("draw_cells_bool") draw_updated_cells_bool = cfg.getboolean("draw_updated_cells_bool") draw_neighbor_count_list_bool = cfg.getboolean( "draw_neighbor_count_list_bool") font_type = cfg["font_type"] neighbor_count_color = literal_eval(cfg["neighbor_count_color"]) # initialization pygame.init() info_object = pygame.display.Info() display_w = info_object.current_w display_h = info_object.current_h size = (width, height) = (cols * cell_size, rows * cell_size) if fullscreen_bool: pygame.display.set_mode((display_w, display_h)) print(fullscreen_bool) screen = pygame.display.set_mode( (0, 0) if fullscreen_bool else size, pygame.FULLSCREEN if fullscreen_bool else 0) debug_font_size = cell_size * 3 font_debug = pygame.freetype.SysFont(font_type, debug_font_size) font_neighbor = pygame.freetype.SysFont(font_type, cell_size) artist = Artist(screen, width, height, font_neighbor, font_debug) artist.offset_fullscreen = ((display_w - size[0]) / 2, (display_h - size[1]) / 2) artist.offset = artist.offset_fullscreen if fullscreen_bool else (0, 0) grid = Grid(cols, rows, cell_size, neighbor_count_color, starter_cells_blueprint, random_starter_cells, artist, screen) grid.set_starter_cells_list() grid.create_update_list() grid.create_neighbor_count_list() artist.fill_screen() if draw_cells_bool: grid.draw_cells() if draw_updated_cells_bool: grid.draw_updated_cells() graph = Graph(screen, width, height, artist) debug_info = Debug_Info(draw_debug_info_bool, draw_cells_bool, draw_updated_cells_bool, draw_neighbor_count_list_bool, grid, update_interval, size, display_w, display_h, artist, graph) event_handler = Event_Handler() return (screen, grid, update_interval, draw_debug_info_bool, draw_neighbor_count_list_bool, size, draw_cells_bool, draw_updated_cells_bool, display_w, display_h, graph, artist, debug_info, event_handler)