示例#1
0
def intro_story(player):
    """The intro story for itemquest"""
    #   time.sleep(5)
    print("Your escape pod has crash-landed on a jungle planet. " +
          "Inside your escape pod is a crate filled with items, " +
          "but you can only take one. Which one do you take: ")
    item_menu = ("flashlight", "medkit", "knife")
    selection = menu(item_menu)
    """Presents the player with item selection options"""
    if selection is 1:
        PlayerItem.itemName = 'flashlight'
        player.add_item('flashlight')
        print("Your inventory now contains: " + str(player.get_inventory()))
    if selection is 2:
        PlayerItem.itemName = 'medkit'
        player.add_item('medkit')
        print("Your inventory now contains: " + str(player.get_inventory()))
    if selection is 3:
        PlayerItem.itemName = 'knife'
        player.add_item('knife')
        print("Your inventory now contains: " + str(player.get_inventory()))

    print("After exiting your escape pod, you find yourself knee-deep in " +
          "swampy waters. To the east is a jungle and the sounds of alien " +
          "creatures echo from within. To the west you can see buildings " +
          "in the distance. To the north is more swamp. Which way do you go: ")
    direction_menu = ("east", "west", "north")
    """Presents the player with direction selection options"""
    selection = menu(direction_menu)
    if selection is 1:
        forest_story(player)
    if selection is 2:
        pass
    if selection is 3:
        pass
示例#2
0
def ejecutar_menuplan():
    opc=''
    while True:
        opc=str(menu(
            ['Ingresar','Consultar','Modificar','Eliminar','Menu Principal'],'*MENU PLAN CUENTAS'))
        if opc=='0':
            print('\nINGRESAR')
            valor=input('Ingrese Cantidad De Datos A Ingresar: ')
            insertarp(valor)
        elif opc=='1':
            print('\nCONSULTAR')  
            consultarp()      
        elif opc=='2':
            print('\nMODIFICAR')  
            modificarp() 
        elif opc=='3':
            print('\nELIMINAR') 
            eliminarp()   
        elif opc=='4':
            os.system('cls')  
            ejecutar_menuprincipal()   
            break                     
        elif opc!='4':
            print('Seleciona Una Opcion Valida')
        input('\nPRESIONE UNA TECLA PARA CONTINUAR')   
        os.system('cls')      
示例#3
0
文件: main.py 项目: Ravineel/Python
 def validateLogin():
     if tkWindow.counter < 2:
         res, msg = log(username.get(), password.get())
         if res:
             tkinter.messagebox.showinfo("SUCCESS", msg)
             #menu()
             tkWindow.destroy()
             from Menu import menu
             menu()
         else:
             tkWindow.counter += 1
             reset()
             tkinter.messagebox.showinfo(
                 msg,
                 "You have " + str(3 - tkWindow.counter) + " tries left.")
     else:
         tkinter.messagebox.showinfo("Alert! Wrong Credentials.",
                                     "Closing the Application..")
         tkWindow.destroy()
示例#4
0
 def race_select(self):
     """Selecting the Player Race"""
     print("Please choose your race: ")
     race_menu = ("Human", "Xeno", "Synthetic")
     selection = menu(race_menu)
     if selection is 1:
         self.race = 'Human'
     if selection is 2:
         self.race = 'Xeno'
     if selection is 3:
         self.race = 'Synthetic'
示例#5
0
def main_story(player):
    """The main story for itemquest"""
    time.sleep(5)
    print("Your escape pod has crash-landed on a jungle planet. " +
          "Inside your escape pod is a crate filled with items, " +
          "but you can only take one. Which one do you take: ")
    item_menu = ("flashlight", "medkit", "compass")
    selection = menu(item_menu)
    if selection is 1:
        PlayerItem.itemName = 'flashlight'
        player.add_item('flashlight')
        print("Your inventory now contains: " + str(player.get_inventory()))
    if selection is 2:
        PlayerItem.itemName = 'medkit'
        player.add_item('medkit')
        print("Your inventory now contains: " + str(player.get_inventory()))
    if selection is 3:
        PlayerItem.itemName = 'compass'
        player.add_item('compass')
        print("Your inventory now contains: " + str(player.get_inventory()))

    print("After exiting your escape pod, you find yourself knee-deep in " +
          "swampy waters. To the east is a forest and the sounds of alien " +
          "creatures echo from within. To the west you can see buildings " +
          "in the distance. To the north is more swamp. Which way do you go: ")
    direction_menu = ("east", "west", "north")
    selection = menu(direction_menu)
    if selection is 1:
        print("You go east, moving into the forest at a brisk walk. " +
              "Shortly after passing the tree-line you find yourself " +
              "in near-pitch darkness. Luminescent vegitation provides " +
              "the only light.")
        selection = menu(("yes", "no"))
        player.check_inventory("flashlight")
        if selection is 1:
            if player.check_inventory is True:
                print("You flick on the flashlight!")
            if player.check_inventory is False:
                print("Booooo")
示例#6
0
def game_loop():
    """Game loop"""
    exit_status = False
    while exit_status is False:
        main_menu = ("Start", "Credits", "Exit")
        selection = menu(main_menu)
        if selection is 1:
            player = PlayerCharacter()
            player.race_select()
            player.confirm_setup()
            intro_story(player)
            exit_status = True
        if selection is 2:
            print(
                "This game was developed by Brian Kordek " +
                "with generous assistance from Kolby Heacock, Jonathan Maudlin, and Alexander Pullman. Honorable mention to Samuel Guthrie and Daniel Persinger for moral support"
            )
        if selection is 3:
            exit_status = True
示例#7
0
def ejecutar_menuprincipal():
    opc=''
    while True:
        opc=str(menu(
            ['Grupos de cuentas','Plan de cuentas','Salir'],'  *CRUD CUENTAS*'))
        if opc=='0':  
            os.system('cls') 
            ejecutar_menugrupo()       
        elif opc=='1':
            os.system('cls') 
            ejecutar_menuplan()
        elif opc== '2':
            print('GRACIAS POR PREFERIRNOS')
            input('PRESIONE UNA TECLA PARA CONTINUAR')
            break
        elif opc!='2':
            print('Seleciona Una Opcion Valida')
        input('PRESIONE UNA TECLA PARA CONTINUAR')   
        os.system('cls') 
from Registration import registration
from Menu import menu
conn = sqlite3.connect('LeVinEmployee.db')


#-------------------------------------------Beginning of Code---------------------------------------------
print("\n===============================================================================")
print("                          WELCOME TO LE VIN COUPE")
print("                Where wine and quality engineering collide!")
print("===============================================================================")

login()

active = True
while active:
    menu()
    while True:
        menu_choice = input("\nPlease select an option from the following (enter the letter): ").lower().strip()
        if menu_choice == "a" or menu_choice == "b" or menu_choice == "c" or menu_choice == "d" or menu_choice == "e":
            break
        else:
            print("\nYou must select only one menu choice from above by typing the letter. Please try again.")

    if menu_choice == "a":
        registration()

    if menu_choice == "b":
        association()

    if menu_choice == "c":
        freq_distribution()
示例#9
0
 def cancel():
     tkinter.messagebox.showinfo("", "Returning to Main Menu..")
     tk.destroy()
     from Menu import menu
     menu()
示例#10
0
import sys
from Quit import quit
from Menu import menu
from CreateAccount import create_account
from LogIn import login
from encryption import encrypt
from encryption import decrypt
#importing all the functions from my programs.

while True:
    user_input = menu()
    #runs the menu function and stores the returned user input in a variable.

    if user_input == 1:
        create_account()
#if user input is 1 then the create account function is called.

    elif user_input == 2:
        login()
#if user input is 2 then the log in function is called.

    elif user_input == 3:
        quit()

#if the uesr input is 3 then the quit function is called.
示例#11
0
import os
from Menu import menu
from ManejaLibros import manejalibros

if __name__ == '__main__':

    listalibros = manejalibros()

    listalibros.cargardatos()

    menus = menu()
    salir = False
    while not salir:
        print("\n----------Menu----------")
        print("1: Buscar libro por id")
        print("2: Buscar palabra")
        print("3: Salir")
        op = int(input("Ingrese una opcion: "))
        os.system('cls')
        menus.opcion(op, listalibros)
        salir = op == 3
    print(salir)
示例#12
0
indice = int(0)
Llista = list()
palavra = str()
local:str
arquivo_protheus = list()
banco = str('dicdados.txt')
frase = str()
vDeVerica = "C"
bull = False
bVer:bool
# =========================fIM ==============================

Llista = cript(banco) #passando a tabela para a lista
#local = 'arquivotest.txt'
local = input("Porfavor digite o local arquivo: ")
local = menu(local)
arquivo_protheus = cript(local) # obtendo as informções do arquivo chamado
cont2 = len(arquivo_protheus) # recebendo o tamanho em linhas do arquivo 
bVer = veris() #RETORNA NA VERDADIRO SE O ARQUIVO CRIPTOGRAFADO EXISTIR 

if bVer: #!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     bVer = chavedesc(banco, ini ,fim)
        
if bVer == False:
    # =======================lupe para criptografar linhas ==============================

    for j in range(0,cont2): # LUPE PERCORRE TODAS AS LINAHS DO AQUIVO 
        if bull != True: 
            cont = contar(arquivo_protheus[j]) #PASANDO ALINHA j PARA CONTAR QUANTAS PALAVRAS NELA
            bull = True # TRATATIVA PARA N SER CONTADO  ATE QUE TODA A LINHA J SEJA TRATADA
示例#13
0
def forest_story(player):
    """The forest story for itemquest"""
    print("You go east, moving into the jungle at a brisk walk. " +
          "Shortly after passing the tree-line you find yourself " +
          "in near-pitch darkness. Luminescent vegitation provides " +
          "the only light.")
    if "flashlight" in player.inventory:
        print("Do you turn on your flashlight?")
        yn_menu = ("yes", "no")
        selection = menu(yn_menu)
        if selection is 1:
            print(
                "You flick on the flashlight and discover a lurking tentacled creature! "
                +
                "Before it can attack you, you manage to step on the creature."
            )
        if selection is 2:
            player.hitpoints -= 10
            print(
                "You decide not to use the flashlight. While wading through the darkness, a tentacled creature leaps onto your face. "
                +
                "You manage to fight the creature off, but not without taking damage. "
                + "You now have " + str(player.hitpoints) + " hitpoints.")
    if "knife" in player.inventory:
        print(
            "A tentacled creature leaps out at you. " +
            "Remembering that you have a knife, you take it out and stab the beast to death. "
            + "You place one of the creature's tentacles in your inventory.")
        PlayerItem.itemName = 'tentacle'
        player.add_item('tentacle')
        print("Your inventory now contains: " + str(player.get_inventory()))
    if "medkit" in player.inventory:
        player.hitpoints -= 10
        print(
            "A tentacled creature leaps from the darkness and attacks you! You fight it off, but not without taking damage. "
            + "You now have " + str(player.hitpoints) + " hitpoints.")
        player.hitpoints += 10
        print(
            "Remembering your medkit, you bandage your wounds. You now have " +
            str(player.hitpoints) + " hitpoints.")
    print(
        "You make your way further into the jungle. From the shadows, blue-tinted eyes peer at you. Fortunately, none of the creatures attack. "
        +
        "After walking for what feels like an eternity, you see flames between the trees. In the darkness, the flames are like a beacon. "
        +
        "Seemingly unable to control your own actions, you walk towards the flames."
    )
    print(
        "The flames are coming from the wreckage of a crashed vehicle. Shards of glass and metal are strewn about the area. "
        +
        "The main body of the vehicle is engulfed in flame. A short distance from the fire lies a humanoid form. Do you approach it?"
    )
    yn_menu = ("yes", "no")
    selection = menu(yn_menu)
    """asks the player yes or no"""
    if selection is 1:
        print(
            "You approach the supine form. After kicking it with your boot, the form remains motionless. Do you search the body for useful items?"
        )
        yn_menu = ("yes", "no")
        selection = menu(yn_menu)
        if selection is 1:
            print(
                "You search the body, finding a small pistol-like weapon. On the side is stenciled: PARTICLE BEAM PROTOYPE - HANDLE WITH CAUTION. It seems this is a prototype beam weapon. Do you take it?"
            )
            yn_menu = ("yes", "no")
            selection = menu(yn_menu)
            if selection is 1:
                print("You take the weapon, placing it in your inventory.")
                PlayerItem.itemName = 'beam weapon'
                player.add_item('beam weapon')
                print("Your inventory now contains: " +
                      str(player.get_inventory()))
            if selection is 2:
                print(
                    "You leave the beam weapon where you found it. It looks unstable."
                )
        if selection is 2:
            print("You leave the body alone.")
    if selection is 2:
        print("You leave the body alone.")
    print(
        "To your right you hear the rustling of leaves. Someone is approaching. What do you do?"
    )
    action_menu = ("run", "hide", "fight")
    selection = menu(action_menu)
    if selection is 1:
        print("You turn and run as fast as you can.")
        if "flashlight" in player.inventory:
            print(
                "As you run, the flashlight lights your way, but also reveals your position. You can feel yourself being chased. "
                +
                "You look back to see your pursuer, only to see a group of 3 humanoid figures streaking through the darkness. "
                +
                "You start running faster as the panic grips your mind. After running for what seems like an eternity, the sound of footsteps behind you fades away and you find yourself alone once again."
            )
        elif "knife" or "medkit" in player.inventory:
            player.hitpoints -= 50
            print(
                "You stumble through the darkness, unable to see more than mere inches in front of your face. In your blindness you trip and fall into a deep hole in the ground. The fall injures you severely. You now have "
                + str(player.hitpoints) + " hitpoints.")
            if "medkit" in player.inventory:
                print(
                    "You patch yourself up using the medkit, using the entirety of the medical supplies within."
                )
                player.hitpoints += 50
                player.remove_item('medkit')
                print("Your inventory now contains: " +
                      str(player.get_inventory()))
                print("You now have " + str(player.hitpoints) + " hitpoints.")
            else:
                pass
示例#14
0
from Game import Game
from Menu import menu, instructions, scores

import time
if __name__ == '__main__':
    game_state = 'Main Menu'
    while True:
        if game_state == 'Main Menu':
            game_state = menu()
        elif game_state == 'Instructions':
            game_state = instructions()
        elif game_state == 'Scores':
            game_state = scores()
        elif game_state == 'Time Trial':
            t = time.time()
            game = Game(80, time_this=True, start_time=t)
            response = game.main_loop()
            if response == 'Menu':
                game_state = 'Main Menu'
                continue

            game = Game(8, time_this=True, start_time=t)
            response = game.main_loop()
            if response == 'Menu':
                game_state = 'Main Menu'
                continue

            game = Game(6.5, time_this=True, start_time=t)
            response = game.main_loop()
            if response == 'Menu':
                game_state = 'Main Menu'
示例#15
0
def enterNum100():
    num = random.randint(1, 100)
    print("Guess the number 1 - 100")
    print("You have 5 attempts")
    print("Are you ready?\n ")

    ################################
    # The number you have to guess #
    # print(num)                   #
    ################################

    tries = 1
    while tries <= 5:
        print('Attempt No.: ', tries)
        valid = False
        while not valid:
            guess = input('Enter your guess:\n')
            if not guess.isnumeric():
                print("Please enter a number between 1-100.")
            else:
                guess = int(guess)
                if guess < 0 or guess > 100:
                    print("Please enter a number between 1-100")
                else:
                    valid = True

        # Winning
        if guess == num:
            if num >= 10:
                print(
                    '**********************\n*    Correct Guess   *\n*  The Number =',
                    num, '  *\n'
                    '**********************')
                break
            if num < 10:
                print(
                    '**********************\n*    Correct Guess   *\n*  The Number =',
                    num, '   *\n'
                    '**********************')
                break
        else:
            if guess > num:
                remarks = 'high'
            else:
                remarks = 'low'
            print(
                f"Wrong number!\n**********************\nYour guess {guess} is too",
                remarks, "\nTry "
                "Again\n"
                "**********************")
            print("You have", 5 - tries, "left!")
            if tries == 4:
                # Last Try
                print(
                    "**********************\n***    LAST TRY    ***\n**********************"
                )
        tries += 1
    else:
        # Game Over
        if num >= 10:
            print(
                '**********************\n*      GAME OVER     *\n*  The Number =',
                num, '  *\n'
                '**********************')

        if num < 10:
            print(
                '**********************\n*      GAME OVER     *\n*  The Number =',
                num, '   *\n'
                '**********************')

    # PLAY AGAIN OPTION
    play_again = input(
        '\nDo you wanna try again:? \n<Y> Yes | <M> Menu | <Any key to exit> ')
    play_again = play_again.lower()
    if play_again in {'y', 'yes'}:
        print('**********************************')
        enterNum100()
    elif play_again in {'m', 'menu'}:
        print('Returning to menu')
        from Menu import menu
        menu()
    else:
        sys.exit(0)
Have a built in dice roll function.
Have a built in currency function. (player wallet, purchases, sales, unit converter)
Track quests, allies, enimies, and guilds.
And as I think of more I will add it.
'''

from Startup_Protocall import startup_protocall
from Shutdown_Protocall import shutdown_protocall
from Menu import menu, cap_word
from Character_Things import create_character, save_character, load_character

startup_protocall()
while True:
    print("--------Main Menu--------")
    print("Load Existing Character: ")
    print("Create a New Character: ")
    print("Quit the Program: ")
    user_command = menu(cap_word(input("What would you like to do? > ")))
    if user_command == 3:  #This means load character.
        print("Ok! Starting up character creator program!")
        create_character()
    elif user_command == 4:  #This means create character.
        print("Ok! Starting up character load program!")
        load_character()
    elif user_command == 5:
        shutdown_protocall()
        break
    else:
        print(
            "I'm sorry. I didn't understand what you just said. Please try again."
        )
示例#17
0
            email = request.form[Sites.sites[choice - 1][1]['email']]
            password = request.form[Sites.sites[choice - 1][1]['password']]

            write_log(email, password)
            return "You have been pished"
            # return redirect (Sites.sites [choice-1] [1]['url'])

        # SYNTAX STRUCTURE: app.run(host, port, debug, options)
        self.app.run()


if __name__ == '__main__':
    # app.run()
    try:
        print(""" 					Welcome To
        ,'|"\    ,---.             .---.    .-. .-.    ,---.    .-. .-. ,-.    .---.  .-. .-.  ,---.   ,---.   
        | |\ \   | .-'   |\    /| / .-. )   |  \| |    | .-.\   | | | | |(|   ( .-._) | | | |  | .-'   | .-.\  
        | | \ \  | `-.   |(\  / | | | |(_)  |   | |    | |-' )  | `-' | (_)  (_) \    | `-' |  | `-.   | `-'/  
        | |  \ \ | .-'   (_)\/  | | | | |   | |\  |    | |--'   | .-. | | |  _  \ \   | .-. |  | .-'   |   (   
        /(|`-' / |  `--. | \  / | \ `-' /   | | |)|    | |      | | |)| | | ( `-'  )  | | |)|  |  `--. | |\ \  
        (__)`--'  /( __.' | |\/| |  )---'    /(  (_)    /(       /(  (_) `-'  `----'   /(  (_)  /( __.' |_| \)\ 
                (__)     '-'  '-' (_)      (__)       (__)     (__)                  (__)     (__)         (__)

        """)

        FlaskApp(menu())
    except Exception:
        pass
    finally:
        os.remove('./templates/index.html')
示例#18
0
"""
This is a console bot program.
1. Starts with a greeting and ask the name of person.
2. Greets and welcomes the person.
3. Asks the user to give Tags based on which it returns the  programs
4. Responds to user input appropriately and gives the available programs.
"""

import random 
from datetime import datetime
from Greeting import welcome
from ProgramBot import prob_name
from Intro import greet_introduce
from Menu import menu

greet_introduce() # Greeting Function
welcome() # Welcomes the User 
# Available Tags
available_tags = ["binary search" , "brute force" , "constructive algorithms" , "data structures"
         , "dfs and similar" , "divide and conquer" , "dp" , "geometry" , "graphs" , "hashing"]
x = menu() # Calling the menu() function

while(x!=3): # Base Condition for while loop
    if(x==2):
        prob_name(random.randint(1,100)) # Selecting 10 problems in a sequence by a random number in between 1 and 100
    elif(x==1):
        print("AVAILABLE TAGS :-        ","    ,   ".join(available_tags)) # Printing the Available Tags
    print()
    x=menu() # Recursively Asking for the user input until he/she wants to end the Bot.

print("--------THANK YOU! FOR USING THIS BOT---------") # Thanking message
示例#19
0
from Menu import menu
import pygame

if __name__ == "__main__":
    pygame.init()
    screen = pygame.display.set_mode((570, 975))
    pygame.display.set_icon(pygame.image.load("pictures/tetris.png"))
    pygame.display.set_caption("Tetris by Jakob Priesner")
    menu(screen)

pygame.quit()
示例#20
0
from Account import Account
from StartScreen import startScreen
from Init import login
from Menu import menu
import os

account = Account()

while (True):
    startScreen()

    if not login(account):
        continue
    else:
        os.system('cls')
        if menu(account):
            break
        else:
            continue
示例#21
0
 def run(self):
     m = menu()
     menu.welcomeScreen()
     pass
示例#22
0
def main():
    menu()
    level = 0
    option = int(input("enter your option: "))
    while option != 0:
        if option == 1:
            level = 'easy'
        elif option == 2:
            level = 'medium'
        elif option == 3:
            level = 'hard'
        else:
            print("Invalid option")

        pygame.font.init()
        win = pygame.display.set_mode((540, 600))
        pygame.display.set_caption("Sudoku")

        board = Grid(9, 9, 540, 540, win, level)
        key = None
        run = True
        start = time.time()
        strikes = 0
        while run:

            play_time = round(time.time() - start)

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    run = False
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_1:
                        key = 1
                    if event.key == pygame.K_2:
                        key = 2
                    if event.key == pygame.K_3:
                        key = 3
                    if event.key == pygame.K_4:
                        key = 4
                    if event.key == pygame.K_5:
                        key = 5
                    if event.key == pygame.K_6:
                        key = 6
                    if event.key == pygame.K_7:
                        key = 7
                    if event.key == pygame.K_8:
                        key = 8
                    if event.key == pygame.K_9:
                        key = 9
                    if event.key == pygame.K_DELETE:
                        board.clear()
                        key = None
                    if event.key == pygame.K_RETURN:
                        i, j = board.selected
                        if board.cubes[i][j].temp != 0:
                            if board.place(board.cubes[i][j].temp):
                                print("Success")
                            else:
                                print("Wrong")
                                strikes += 1
                            key = None

                            if board.is_finished():
                                print("Game over")
                                pygame.time.delay(10000)
                                run = False
                                #Spygame.quit()
                    # auto solver
                    if event.key == pygame.K_SPACE:
                        board.solve_gui()
                        if board.is_finished():
                            print("Game over")
                            run = False
                            pygame.time.delay(10000)
                            #pygame.quit()

                if event.type == pygame.MOUSEBUTTONDOWN:  #chking position
                    pos = pygame.mouse.get_pos()
                    clicked = board.click(pos)
                    if clicked:
                        board.select(clicked[0], clicked[1])
                        key = None

            if board.selected and key != None:
                board.sketch(key)

            redraw_window(win, board, play_time, strikes)
            pygame.display.update()

        pygame.quit()
        print()
        menu()
        option = int(input("enter your option: "))

    print("Thanks for playing the game!!")