def run(scen_list): pygame.init() pygame.font.init() DISPLAY_WIDTH = 320 DISPLAY_HEIGHT = 240 screen = pygame.display.set_mode((DISPLAY_WIDTH, DISPLAY_HEIGHT)) pygame.event.set_allowed([pygame.MOUSEMOTION, pygame.MOUSEBUTTONUP, pygame.QUIT, pygame.KEYDOWN]) scsel = ScenarioSelectScreen(screen) scsel.set_scenarios(scen_list.scenarios) mouse_pos = None # Absolute position of the mouse, or L{None} if unknown. while True: scsel.draw(mouse_pos) pygame.display.flip() while True: # Only events that are allowed get here! # See pygame.event.set_allowed. event = pygame.event.wait() if event.type == pygame.MOUSEMOTION: mouse_pos = event.pos break if event.type == pygame.MOUSEBUTTONUP: print event.pos, event.button if event.type == pygame.QUIT: return if event.type == pygame.KEYDOWN and event.key == ord('q'): return