Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

splash.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. class SplashScreen:
  9. def __init__(self, g, width = 32, height = 32):
  10. self.gui = g
  11. self.width = width
  12. self.height = height
  13. def draw(self):
  14. self.gui.set_pixel( 0, 0, (255, 255, 255))
  15. self.gui.set_pixel( 0, self.height - 1, ( 0, 0, 255))
  16. self.gui.set_pixel(self.width - 1, 0, (255, 0, 0))
  17. self.gui.set_pixel(self.width - 1, self.height - 1, ( 0, 255, 0))
  18. for i in range(0, int(min(self.width, self.height) / 3)):
  19. self.gui.set_pixel((self.width / 2) - 1 + i, (self.height / 2) - 1 + i, (255, 255, 255))
  20. self.gui.set_pixel((self.width / 2) - 1 - i, (self.height / 2) - 1 - i, (255, 255, 255))
  21. self.gui.set_pixel((self.width / 2) - 1 + i, (self.height / 2) - 1 - i, (255, 255, 255))
  22. self.gui.set_pixel((self.width / 2) - 1 - i, (self.height / 2) - 1 + i, (255, 255, 255))
  23. def finished(self):
  24. return True
  25. def restart(self):
  26. pass
  27. if __name__ == "__main__":
  28. import platform
  29. t = None
  30. if platform.machine() == "armv7l":
  31. from pi import PiMatrix
  32. t = PiMatrix()
  33. else:
  34. from test import TestGUI
  35. t = TestGUI()
  36. s = SplashScreen(t)
  37. s.draw()
  38. t.debug_loop(s.draw)