Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

livingroom.py 1.7KB

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. from splash import SplashScreen
  11. from scroll import ScrollText
  12. from solid import Solid
  13. from life import GameOfLife
  14. from net import CheckHTTP
  15. from image import ImageScreen
  16. from qr import QRScreen
  17. from snake import Snake
  18. from gamepad import InputWrapper
  19. from manager import Manager
  20. from tetris import Tetris
  21. from breakout import Breakout
  22. from weather import WeatherScreen
  23. from config import Config
  24. import util
  25. # Need to import InputWrapper before initializing RGB Matrix on Pi
  26. i = util.getInput()
  27. t = util.getTarget(i)
  28. # Loading fonts and graphics takes a while.
  29. # So show a splash screen while the user waits.
  30. splash = SplashScreen(t)
  31. t.loop_start()
  32. splash.draw()
  33. t.loop_end()
  34. m = Manager(t, i)
  35. m.add(ImageScreen(t, "cann.png"))
  36. m.add(Solid(t, 1.0))
  37. m.add(WeatherScreen(t, i, Config.weather_latlon))
  38. m.add(Solid(t, 1.0))
  39. m.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  40. m.add(Solid(t, 1.0))
  41. m.add(ImageScreen(t, "cann2.png"))
  42. m.add(Solid(t, 1.0))
  43. m.add(ImageScreen(t, "earth.gif"))
  44. m.add(Solid(t, 1.0))
  45. #m.add(Breakout(t, i))
  46. #m.add(Solid(t, 1.0))
  47. #m.add(Tetris(t, i,))
  48. #m.add(Solid(t, 1.0))
  49. #m.add(Snake(t, i, camp_pink, camp_green))
  50. #m.add(Solid(t, 1.0))
  51. m.restart()
  52. util.loop(t, m.draw)