Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

splash.py 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 util
  29. t = util.getTarget()
  30. s = SplashScreen(t)
  31. t.debug_loop(s.draw)