1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
-
-
-
-
-
-
-
-
-
-
-
-
- import interstate75
-
- class PicoMatrix:
- def __init__(self, w = 32, h = 32):
- self.width = w
- self.height = h
-
- self.panelW = w
- self.panelH = h
-
-
- self.multiplier = 1.0
-
- if (w != 32) or (h != 32):
- raise RuntimeError("TODO not yet supported")
-
- self.matrix = interstate75.Interstate75(display = interstate75.DISPLAY_INTERSTATE75_32X32)
-
- self.loop_start()
-
- def loop_start(self):
- self.matrix.display.clear()
- return False
-
- def loop_end(self):
- self.matrix.update()
-
- def loop(self, func = None):
- while True:
- if self.loop_start():
- break
- if func != None:
- func()
- self.loop_end()
- self.matrix.stop()
-
- def set_pixel(self, x, y, color):
- if (x < 0) or (y < 0) or (x >= self.width) or (y >= self.height):
- return
-
- pen = self.matrix.display.create_pen(color[0], color[1], color[2])
- self.matrix.display.set_pen(pen)
- self.matrix.display.pixel(int(x), int(y))
-
- if __name__ == "__main__":
- t = PicoMatrix(32, 32)
- t.loop(lambda: t.set_pixel(15, 15, (255, 255, 255)))
|