main.py 766 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!./bin/python3
  2. import os
  3. import yaml
  4. import threading
  5. # Include pygame without support prompt
  6. # Typing only available from version >= 2.0
  7. os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
  8. import pygame # type: ignore
  9. from musikautomat import Musikautomat
  10. # Configuration
  11. config = yaml.safe_load(open("config.yml"))
  12. fbdev = config.get("fbdev", "/dev/fb0")
  13. dx = config.get("dimx", 128)
  14. dy = config.get("dimy", 160)
  15. # Initialise pygame
  16. os.environ["SDL_FBDEV"] = fbdev
  17. pygame.init()
  18. # Create the display
  19. print("Trying to open %s with %sx%s" % (fbdev, dx, dy))
  20. pydsp = pygame.display.set_mode((dx, dy))
  21. pygame.display.set_caption("Musikautomat")
  22. pygame.mouse.set_visible(False)
  23. pygame.key.set_repeat(400, 100)
  24. ma = Musikautomat(pydsp, config)
  25. ma.runDisplay()