Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

splash.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python3
  2. class SplashScreen:
  3. def __init__(self, g, width = 32, height = 32):
  4. self.gui = g
  5. self.width = width
  6. self.height = height
  7. def draw(self):
  8. self.gui.set_pixel( 0, 0, (255, 255, 255))
  9. self.gui.set_pixel( 0, self.height - 1, ( 0, 0, 255))
  10. self.gui.set_pixel(self.width - 1, 0, (255, 0, 0))
  11. self.gui.set_pixel(self.width - 1, self.height - 1, ( 0, 255, 0))
  12. for i in range(0, int(min(self.width, self.height) / 3)):
  13. self.gui.set_pixel((self.width / 2) - 1 + i, (self.height / 2) - 1 + i, (255, 255, 255))
  14. self.gui.set_pixel((self.width / 2) - 1 - i, (self.height / 2) - 1 - i, (255, 255, 255))
  15. self.gui.set_pixel((self.width / 2) - 1 + i, (self.height / 2) - 1 - i, (255, 255, 255))
  16. self.gui.set_pixel((self.width / 2) - 1 - i, (self.height / 2) - 1 + i, (255, 255, 255))
  17. def finished(self):
  18. return True
  19. def restart(self):
  20. pass
  21. if __name__ == "__main__":
  22. import platform
  23. t = None
  24. if platform.machine() == "armv7l":
  25. from pi import PiMatrix
  26. t = PiMatrix()
  27. else:
  28. from test import TestGUI
  29. t = TestGUI()
  30. s = SplashScreen(t)
  31. s.draw()
  32. t.debug_loop(s.draw)