Added pygame quit function
This commit is contained in:
parent
6b0af5ba4d
commit
0561c62467
@ -109,7 +109,10 @@ class CAWindow:
|
|||||||
draw_duration=(time_ds_end - time_ca_end),
|
draw_duration=(time_ds_end - time_ca_end),
|
||||||
evolution_step=self._cellular_automaton.evolution_step)
|
evolution_step=self._cellular_automaton.evolution_step)
|
||||||
self._sleep_to_keep_rate(time.time() - time_ca_start, evolutions_per_second)
|
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
|
def _sleep_to_keep_rate(self, time_taken, evolutions_per_second): # pragma: no cover
|
||||||
if evolutions_per_second > 0:
|
if evolutions_per_second > 0:
|
||||||
rest_time = 1.0 / evolutions_per_second - time_taken
|
rest_time = 1.0 / evolutions_per_second - time_taken
|
||||||
|
Loading…
Reference in New Issue
Block a user