Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

camp_small.py 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. camp_pink = (251, 72, 196)
  9. camp_green = (63, 255, 33)
  10. if __name__ == "__main__":
  11. from splash import SplashScreen
  12. from draw import ScrollText
  13. from solid import Solid
  14. from life import GameOfLife
  15. from net import CheckHTTP
  16. from image import ImageScreen
  17. from qr import QRScreen
  18. from manager import Manager
  19. url = "http://ubabot.frubar.net"
  20. import util
  21. t = util.getTarget()
  22. # Loading fonts and graphics takes a while.
  23. # So show a splash screen while the user waits.
  24. splash = SplashScreen(t)
  25. t.loop_start()
  26. splash.draw()
  27. t.loop_end()
  28. # UbaBot is online
  29. success = Manager(t)
  30. success.add(ImageScreen(t, "drinka.gif", 0.2, 2, 20.0))
  31. success.add(Solid(t, 1.0))
  32. success.add(QRScreen(t, url, 30.0, "Drinks:", "tom-thumb", (255, 255, 255), (0, 0, 0)))
  33. success.add(Solid(t, 1.0))
  34. # UbaBot is offline
  35. fail = Manager(t)
  36. fail.add(ImageScreen(t, "attention.gif", 0.2, 2, 20.0, (0, 0, 0)))
  37. fail.add(ScrollText(t, "The UbaBot Cocktail machine is currently closed. Please come back later for more drinks!", "lemon", 2, 75, camp_pink))
  38. fail.add(Solid(t, 1.0))
  39. fail.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  40. fail.add(Solid(t, 1.0))
  41. # UbaBot status checker
  42. d = CheckHTTP(url)
  43. d.success(success)
  44. d.fail(fail)
  45. # Main "Menu"
  46. m = Manager(t)
  47. m.add(ScrollText(t, "#CCCAMP23", "lemon", 1, 75, camp_green))
  48. m.add(Solid(t, 1.0))
  49. m.add(ImageScreen(t, "Favicon.png", 0, 1, 10.0))
  50. m.add(Solid(t, 1.0))
  51. m.add(d) # HTTP Check, either "success" or "fail"
  52. m.add(Solid(t, 1.0))
  53. m.add(ScrollText(t, "Your advertisement could appear here. Open a Pull Request on git.xythobuz.de/thomas/rgb-matrix-visualizer or send an e-mail to thomas@xythobuz.de", "iv18x16u", 2, 70, camp_green))
  54. m.add(Solid(t, 1.0))
  55. m.restart()
  56. t.debug_loop(m.draw)