def main(): # pygame initialization pygame.init() pygame.mixer.music.load('sounds/menu.mp3') pygame.mixer.music.play(-1) pygame.display.set_caption('PyFighters') pygame.mouse.set_visible(1) clock = pygame.time.Clock() # code for our menu ourMenu = ("Play Online", "How to play", "Statistics", "Exit") myMenu = Menu(ourMenu) myMenu.drawMenu() pygame.display.flip() # main loop for event handling and drawing while 1: clock.tick(60) # Handle Input Events for event in pygame.event.get(): myMenu.handleEvent(event) # quit the game if escape is pressed if event.type == QUIT: sys.exit(0) elif event.type == Menu.MENUCLICKEDEVENT: if event.text == "Play Online": time.sleep(1) character = CharSelect.charselect() print "Just Waiting..." InitScript.main(socketInit(), character) elif event.text == "How to play": Settings.settings() elif event.text == "Local Play": Script.main() elif event.text == "Exit": sys.exit(0) elif event.type == KEYDOWN and event.key == K_ESCAPE: myMenu.activate() sys.exit(0) if myMenu.isActive(): myMenu.drawMenu() pygame.display.flip()