From 5fefd0b0bbb0c238ddd0cee6233d135888929f27 Mon Sep 17 00:00:00 2001 From: kris Date: Wed, 24 Nov 2021 15:24:58 +0000 Subject: [PATCH] Don't initialize pygame if --no-show-output --- convert.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/convert.py b/convert.py index 6347aad..dfaede3 100644 --- a/convert.py +++ b/convert.py @@ -352,13 +352,14 @@ def main(): inner_iterations = 10 outer_iterations = 20 - pygame.init() - # TODO: for some reason I need to execute this twice - the first time - # the window is created and immediately destroyed - _ = pygame.display.set_mode((640, 400)) - canvas = pygame.display.set_mode((640, 400)) - canvas.fill((0, 0, 0)) - pygame.display.flip() + if args.show_output: + pygame.init() + # TODO: for some reason I need to execute this twice - the first time + # the window is created and immediately destroyed + _ = pygame.display.set_mode((640, 400)) + canvas = pygame.display.set_mode((640, 400)) + canvas.fill((0, 0, 0)) + pygame.display.flip() total_image_error = None # TODO: reserved_colours should be a flag