main.py 717 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/fb1")
  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. pydsp = pygame.display.set_mode((dx, dy), 0, 32)
  20. pygame.display.set_caption("Musikautomat")
  21. pygame.mouse.set_visible(False)
  22. pygame.key.set_repeat(400, 100)
  23. ma = Musikautomat(pydsp, config)
  24. ma.runDisplay()