fixed close button not working

This commit is contained in:
Richard Feistenauer 2019-03-03 09:31:41 +01:00
parent 0f63e5bbe6
commit 20aaa98c23
2 changed files with 4 additions and 2 deletions

View File

@ -1 +0,0 @@
from .cellular_automaton import *

View File

@ -86,7 +86,6 @@ class CAWindow:
running = True running = True
while running: while running:
pygame.event.get()
time_ca_start = time.time() time_ca_start = time.time()
self._ca.evolve_x_times(evolution_steps_per_draw) self._ca.evolve_x_times(evolution_steps_per_draw)
time_ca_end = time.time() time_ca_end = time.time()
@ -94,6 +93,10 @@ class CAWindow:
time_ds_end = time.time() time_ds_end = time.time()
self.__print_process_duration(time_ca_end, time_ca_start, time_ds_end) 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): 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._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") self.__write_text((10, 5), "CA: " + "{0:.4f}".format(time_ca_end - time_ca_start) + "s")