From 0561c624670d030f4691a13c2fb24110d43d048f Mon Sep 17 00:00:00 2001 From: timofej Date: Wed, 16 Aug 2023 22:41:54 +0200 Subject: [PATCH] Added pygame quit function --- neuropercolation/display.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neuropercolation/display.py b/neuropercolation/display.py index 79a403d..19ee899 100644 --- a/neuropercolation/display.py +++ b/neuropercolation/display.py @@ -109,7 +109,10 @@ class CAWindow: draw_duration=(time_ds_end - time_ca_end), evolution_step=self._cellular_automaton.evolution_step) self._sleep_to_keep_rate(time.time() - time_ca_start, evolutions_per_second) - + try: + self.__draw_engine._pygame.quit() + except: + print('Failed to quit pygame') def _sleep_to_keep_rate(self, time_taken, evolutions_per_second): # pragma: no cover if evolutions_per_second > 0: rest_time = 1.0 / evolutions_per_second - time_taken