raspberry pi zero based drum machine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sExit.py 772B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import FSM
  2. import utils as u
  3. import menus as m
  4. import pygame
  5. import sys
  6. #====================================
  7. State = type("State", (object,), {})
  8. #====================================
  9. class State(object):
  10. def __init__(self, FSM):
  11. self.FSM = FSM
  12. def Enter(self):
  13. pass
  14. def Execute(self):
  15. pass
  16. def Exit(self):
  17. pass
  18. class Exit(State):
  19. def __init__(self,FSM):
  20. super(Exit, self).__init__(FSM)
  21. def Enter(self):
  22. o = self.FSM.owner
  23. o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)
  24. o.center_block("goodbye", o.h2, [0, 0, o.width,o.height], o.light_grey)
  25. o.update_display(0)
  26. pygame.quit()
  27. sys.exit()
  28. super(Exit, self).Enter()
  29. def Execute(self):
  30. self.FSM.stateLife += 1
  31. def Exit(self):
  32. pass