Exemple #1
0
    def update_fig(n):
        global state_1, state_2

        life_update(state_1, state_2)
        state_1, state_2 = state_2, state_1  # swap buffers

        img.set_array(state_1)

        return img,
Exemple #2
0
    def update_fig(n):
        global state_1, state_2

        life_update(state_1, state_2)
        state_1, state_2 = state_2, state_1  # swap buffers

        img.set_array(state_1)

        return (img,)
Exemple #3
0
    def compute(self):
        """Computation thread"""
        while not self.stop_computation:
            # Wait for a permission to render the next frame
            self.update_event.wait()

            # Render the next frame (let's hope it releases the GIL!!)
            life_update(self.buffers[0], self.buffers[1])

            # Signal that we finished redrawing the frame
            self.update_event.clear()