def resume(): RESUME = pygame.image.load('../media/images/resume.gif') SCREEN.blit(RESUME, (0, 0)) while True: process() pygame.display.update() clicked = pygame.mouse.get_pressed() pos = pygame.mouse.get_pos() if clicked[0] is 1: if 300 < pos[0] < 450 and 310 < pos[1] < 350: mainmenu() break elif 520 < pos[0] < 660 and 310 < pos[1] < 350: break CLOCK.tick(FPS)
def statehandler(stdscr, screen, screen_panel, field_h, field_w, mine_num): done = False nextstate = 'menu' while not(done == True): if nextstate == 'game': nextstate = game(stdscr, screen, screen_panel, field_h, field_w, mine_num) if nextstate == 'quit': return if nextstate == 'menu': nextstate = mainmenu(stdscr, screen, screen_panel)
''' import pygame, mainmenu, level1, level2, level3, gameOver pygame.init() pygame.mixer.init() if __name__ == "__main__": donePlaying = False while donePlaying == False: level = mainmenu.mainmenu() while level >= 0: if level == 0: level = mainmenu.mainmenu() if level == 1: level = level1.main() if level == 2: level = level2.main() if level == 3: level = level3.main() level, donePlaying = gameOver.main()
import howtoplay import credits CLOCK = pygame.time.Clock() game_state = 0 score = 0 run = True while run: if(game_state == 0): # setting up the cursor for mainmenu if(pygame.mouse.get_cursor() != pygame.cursors.arrow): pygame.mouse.set_cursor(*pygame.cursors.arrow) # main menu game_state = mainmenu.mainmenu(score) elif(game_state == 1): # setting the cursor for mainloop if(pygame.mouse.get_cursor() != pygame.cursors.diamond): pygame.mouse.set_cursor(*pygame.cursors.diamond) # main game logic game_state, score = mainlogic.mainloop() elif(game_state == 2): # how to play menu game_state = howtoplay.howtoplay() elif(game_state == 3): # credits menu game_state = credits.credits()
def main(): while True: if mainmenu() == "exit": exitprog()
def day_scheduler(): #Presenting a menu to the user, this will be ported to gui soon if everything goes as per plan. count = 1 #we need this later on for the menus in the delete menu #Validating user's input. while True: while True: try: print( "Please choose an option from the following menu. \n 1. Add a task. \n 2. View current list of tasks. \n 3. delete a task. \n 4. Start my day.\n 5. Return to the main menu. \n 6. Exit." ) option = int(input("Please choose an option.")) except: print("Invalid input! Please enter a number.") continue if option in range(1, 7): break else: print("Please pick a valid number from the given menu") continue #Actually coding these options in now. if option == 2: if len(tasklist) == 0: print("There are 0 tasks skeduled right now.") continue else: print("There are currently ", len(tasklist), "tasks skeduled which are as follows.", tasklist) continue elif option == 1: taskname = input("Enter a name for your new task.") while True: tasktime = input( "Enter the time at which you want to start this task. Your input should be in the form of hh:min. For example, 08:30 for 8 30 in the morning." ) if int(tasktime[0:tasktime.index(":")]) in range( 0, 24) and int(tasktime[tasktime.index(":") + 1:]) in range(0, 61): break else: print("Invalid input of time spicified. Please try again.") continue tasklist.append(taskname + ",at" + tasktime) schedule.every().day.at(tasktime).do(job, n=taskname) print( "All done! You will be notified when the task has to be done.") continue elif option == 4: print("Starting your day, now!") task_notifier() elif option == 6: print("Exiting.") time.sleep(1) sys.exit() elif option == 3: print("Choose the task to be deleted from the following menu.") while True: for i in tasklist: print(count, i) count += 1 try: taskdel = int(input("Choose a task.")) except: print("Please enter a number.") continue if taskdel not in range(1, len(tasklist) + 1): print("Invalid option. Please try again.") continue tasktodel = tasklist[taskdel - 1] tasklist.remove(tasktodel) tasktodel = tasktodel[0:tasktodel.index(",")] schedule.cancel_job(tasktodel) print("Deleted successfully!") break elif option == 5: mainmenu.mainmenu()
import mainmenu, pomodoro, day_skeduler mainmenu.mainmenu()
def __init__(self): self.main_menu = mainmenu.mainmenu() game_stack.Append(self.main_menu)
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32) text = drawtext('PRODUCTION GROUND', 32) BACKGROUND = pygame.image.load('../media/images/main_back.png') # music module pygame.mixer.music.load('../media/music/bensound-slowmotion.mp3') pygame.mixer.music.play(-1) # game start module gamestart() # MAIN MENU mainmenu() while True: process() click() SCREEN.blit(BACKGROUND, (0, 0)) SCREEN.blit(text, (260, 20)) # file usage f = open('../data_files/money.txt', 'r') for line in f: line = line[:-1]