From d40c7d9f09d9b012837d6060a4c598b23b19646f Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Thu, 17 May 2018 18:18:11 +0100 Subject: Palette, tools, load & save working --- unicorn_hat_sim.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'unicorn_hat_sim.py') diff --git a/unicorn_hat_sim.py b/unicorn_hat_sim.py index 9d7d1a0..c2cd8b1 100644 --- a/unicorn_hat_sim.py +++ b/unicorn_hat_sim.py @@ -27,7 +27,8 @@ class UnicornHatSim(object): pygame.init() pygame.display.set_caption("Unicorn HAT simulator") self.screen = pygame.display.set_mode([self.window_width, self.window_height]) - self.clear() + # self.clear() + self.screen.fill((0, 0, 0)) def set_pixel(self, x, y, r, g, b): i = (x * self.width) + y @@ -55,7 +56,8 @@ class UnicornHatSim(object): self.draw_led(x, y) def show(self): - self.clear() + # self.clear() + self.screen.fill((0, 0, 0)) self.draw() pygame.display.flip() @@ -81,8 +83,9 @@ class UnicornHatSim(object): self._rotation = int(round(r/90.0)) % 3 def clear(self): - self.screen.fill((0, 0, 0)) - + # self.screen.fill((0, 0, 0)) + self.pixels = [(0, 0, 0)] * self.width * self.height + def get_rotation(self): return self._rotation * 90 -- cgit v1.2.3-ZIG