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.

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python3
  2. # ----------------------------------------------------------------------------
  3. # "THE BEER-WARE LICENSE" (Revision 42):
  4. # <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  5. # you can do whatever you want with this stuff. If we meet some day, and you
  6. # think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  7. # ----------------------------------------------------------------------------
  8. import time
  9. class Solid:
  10. def __init__(self, g, t = 1.0, c = (0, 0, 0)):
  11. self.gui = g
  12. self.time = t
  13. self.color = c
  14. self.restart()
  15. def restart(self):
  16. self.start = time.time()
  17. def finished(self):
  18. return (time.time() - self.start) >= self.time
  19. def draw(self):
  20. for x in range(0, self.gui.width):
  21. for y in range(0, self.gui.height):
  22. self.gui.set_pixel(x, y, self.color)
  23. if __name__ == "__main__":
  24. import util
  25. t = util.getTarget()
  26. d = Solid(t, 1.0, (0, 255, 0))
  27. t.debug_loop(d.draw)