From 20aaa98c232a30a748f4ae81b03a912a4c5ee7a5 Mon Sep 17 00:00:00 2001 From: Richard Feistenauer Date: Sun, 3 Mar 2019 09:31:41 +0100 Subject: [PATCH] fixed close button not working --- __init__.py | 1 - cellular_automaton/display.py | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 __init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index 79356a6..0000000 --- a/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .cellular_automaton import * \ No newline at end of file diff --git a/cellular_automaton/display.py b/cellular_automaton/display.py index 11e683e..b8f5013 100644 --- a/cellular_automaton/display.py +++ b/cellular_automaton/display.py @@ -86,7 +86,6 @@ class CAWindow: running = True while running: - pygame.event.get() time_ca_start = time.time() self._ca.evolve_x_times(evolution_steps_per_draw) time_ca_end = time.time() @@ -94,6 +93,10 @@ class CAWindow: time_ds_end = time.time() self.__print_process_duration(time_ca_end, time_ca_start, time_ds_end) + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + def __print_process_duration(self, time_ca_end, time_ca_start, time_ds_end): self._screen.fill([0, 0, 0], ((0, 0), (self.__window_size[0], 30))) self.__write_text((10, 5), "CA: " + "{0:.4f}".format(time_ca_end - time_ca_start) + "s")