Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

solid.py 773B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. import time
  3. class Solid:
  4. def __init__(self, g, t = 1.0, c = (0, 0, 0)):
  5. self.gui = g
  6. self.time = t
  7. self.color = c
  8. self.restart()
  9. def restart(self):
  10. self.start = time.time()
  11. def finished(self):
  12. return (time.time() - self.start) >= self.time
  13. def draw(self):
  14. for x in range(0, self.gui.width):
  15. for y in range(0, self.gui.height):
  16. self.gui.set_pixel(x, y, self.color)
  17. if __name__ == "__main__":
  18. import platform
  19. t = None
  20. if platform.machine() == "armv7l":
  21. from pi import PiMatrix
  22. t = PiMatrix()
  23. else:
  24. from test import TestGUI
  25. t = TestGUI()
  26. d = Solid(t, 1.0, (0, 255, 0))
  27. t.debug_loop(d.draw)