示例#1
0
    def show_budgetmenu(self):
        # prints out budget menu info (available categories and options)
        self.update_categories()
        self.print_budget_greetings_banner()
        self.print_categories()
        file_menu_option_list = [
            'ADD new Purchase', 'CREATE new Category',
            'DELETE existing Category', 'REPORTS', 'Main Menu', 'Quit'
        ]

        selection = pyip.inputMenu(
            file_menu_option_list,
            prompt='\n\n\nWhat would you like to do?\n\n',
            numbered=True)
        user_response = (selection.split())[0]
        time.sleep(0.5)
        return user_response
示例#2
0
    def encrypt(cls, public_key, elGamalKeys, key, method='RSA'):
        plaintext = pyip.inputStr('Entrer le message a crypter :  ')
        plaintext = str.encode(plaintext)

        if (method == 'RSA'):
            choice = pyip.inputMenu(
                ['Crypter le message', 'Signer le message'])
            if (choice == 'Crypter le message'):
                cipher = AsymmetricEncryption.rsaEncrypt(
                    plaintext, public_key, key)
                return ('encrypt', cipher)
            elif (choice == 'Signer le message'):
                signature = AsymmetricEncryption.rsaSign(plaintext, key)
                return ('sign', signature)
        elif (method == 'ElGamal'):
            cipher = AsymmetricEncryption.elgamalEncrypt(
                plaintext.decode(), elGamalKeys)
            return ('encrypt', cipher)
示例#3
0
def main():
    timer_choice = pyin.inputMenu(
        [
            'timer/alarm', 'interval timer', 'pomodoro timer', 'stopwatch',
            'alt pomodoro'
        ],
        prompt='Choose which kind of timer you want \n',
        numbered=True)
    if timer_choice == 'timer/alarm':
        timer()
    elif timer_choice == 'interval timer':
        interval_timer()
    elif timer_choice == 'pomodoro timer':
        pomotimer()
    elif timer_choice == 'alt pomodoro':
        alt_pomodoro()
    else:
        stopwatch()
def displayby():
    displaytable = PrettyTable()
    displaytable.field_names = ['Account_id','UserID','Pass','Remarks','PurposeID'] #for the query
    items = list(cursor.execute('''SELECT * from Purpose''').fetchall())
    key_list = [str(item[0]) for item in items ]
    displaypurpose()
    print('Choose the following keys:')
    if len(key_list) >= 2:
        choose_key = pyip.inputMenu(key_list,numbered=True) #choose the key of the item
        print(choose_key)
        action = 'SELECT * from Accounts WHERE PurposeID = "{0}"'.format(choose_key)
    else:
        action = 'SELECT * from Accounts WHERE PurposeID = {0}'.format(key_list[0])

    toshow = db.execute(action).fetchall()
    for data in toshow:
        displaytable.add_row([data[0],data[1],data[2],data[3],data[4]])
    print(displaytable)
示例#5
0
def menu():
    while (True):
        choice = pyip.inputMenu([
            'encoding', 'hashing', 'pwdCracker', 'symmetric-encrypt',
            'asymmetric-encrypt', 'quit'
        ])
        if (choice == 'encoding'):
            Encoding.menu()
        elif (choice == 'hashing'):
            Hashing.hash_menu()
        elif (choice == 'pwdCracker'):
            Hashing.crack_menu()
        elif (choice == 'symmetric-encrypt'):
            SymmetricEncryption.menu()
        elif (choice == 'asymmetric-encrypt'):
            AsymmetricEncryption.menu()

        elif (choice == 'quit'):
            return
示例#6
0
def show_mainmenu(available_budgets):
    # print out main menu (existing budgets and menu options: open, create, delete, quit)
    # returns user's choice
    option_list = ['OPEN Budget', 'CREATE Budget', 'DELETE Budget', 'Quit']

    # Print out list of available budgets. If none, print none found
    if len(available_budgets) >= 1:
        print(f'\n\n\nExisting Budgets: {", ".join(available_budgets)}')
    else:
        print('No budgets found!\n\n')

    selection = pyip.inputMenu(option_list,
                               prompt='\n\n\nWhat would you like to do?\n\n',
                               numbered=True)

    # Get Keyword(first word) from user selection, store as user response
    user_response = (selection.split())[0]
    time.sleep(0.5)
    return user_response
示例#7
0
def menu():
    while (True):
        choice = pyip.inputMenu([
            'Codage', 'Hachage', 'Cracker mot de passe',
            'Cryptage/Decryptage symétrique',
            'Cryptage/Decryptage asymétrique', 'Quitter'
        ])
        if (choice == 'Codage'):
            Encoding.menu()
        elif (choice == 'Hachage'):
            Hashing.hash_menu()
        elif (choice == 'Cracker mot de passe'):
            Hashing.crack_menu()
        elif (choice == 'Cryptage/Decryptage symétrique'):
            SymmetricEncryption.menu()
        elif (choice == 'Cryptage/Decryptage asymétrique'):
            AsymmetricEncryption.menu()

        elif (choice == 'Quitter'):
            return
示例#8
0
 def account_menu(self):
     """
     A menu for account 
     """
     menuArr = [
         "Enter an existing account", "Creating a new account", "Main Menu",
         "QUIT"
     ]
     print('=' * 20 + ' ACCOUNT ' + '=' * 20)
     option = pyip.inputMenu(menuArr, numbered=True, blank=True)
     if option == menuArr[0]:
         acc.add_existing_account()
     if option == menuArr[1]:
         acc.create_new_account()
     if option == menuArr[-2]:
         self.main_menu()
     if option == menuArr[-1]:
         sys.exit()
     time.sleep(2)
     self.main_menu()
示例#9
0
def mainMenu():
    while True:
        print('Welcome to ChoreMaster. What would you like to do?\n')
        menuChoice = pyip.inputMenu(taskList, numbered=True)

        if menuChoice == 'Add a person':
            print()
            getAssignees()
        elif menuChoice == 'Add a chore':
            print()
            getChores()
        elif menuChoice == 'Assign chores':
            print()
            assignChores()
        elif menuChoice == 'Email assignees':
            print()
            emailAssignedChores()
        elif menuChoice == 'Exit':
            print()
            print('Exiting ChoreMaster. See you again soon!')
            sys.exit()
def review_information():
    """Lets the user decide between all content, single entry and all entries matching a condition.
    """
    try:
        file = open("AddressBook.csv", "r", newline='')
    except IOError:
        print("File not found.")
    filereader = csv.DictReader(file) # fieldnames=fieldnames)


    entry = pyip.inputMenu(['show all content', 'show a single entry',
                           'show all entries that match a condition'],
                           numbered=True)
    if entry == 'show all content':
        for row in filereader:
            print(row)
    if entry == 'show a single entry':
        single_entry(filereader)
    if entry == 'show all entries that match a condition':
        filter_entries(filereader)
    file.close()
示例#11
0
def printFromMenu():
    """  Print the specified information from the menu option chosen.
    """

    while True:
        print()
        responce = pyip.inputMenu(["Platform", "Boot Time",
                                   "CPU", "Memory", "Disk", "Network",
                                   "Python", "All", "Quit"], numbered=True)

        if responce == "Platform" or responce == "All":
            printSeperator("Platform Information")
            printPlatfrom()

        if responce == "Boot Time" or responce == "All":
            printSeperator("Boot Time")
            printBootTime()

        if responce == "CPU" or responce == "All":
            printSeperator("CPU Information")
            printCPUInfo()

        if responce == "Memory" or responce == "All":
            printSeperator("Memory Information")
            printMemoryInfo()

        if responce == "Disk" or responce == "All":
            printSeperator("Disk Information")
            printDiskInfo()

        if responce == "Network" or responce == "All":
            printSeperator("Network Information")
            printNetworkInfo()
            
        if responce == "Python" or responce == "All":
            printSeperator("Python Information")
            printPythonInfo()

        if responce == "Quit":
            break
示例#12
0
def droneselect():
    clearConsole()
    print('===Drones Avaliable===')
    time.sleep(0.2)
    print('Drone Bay [1] Status - Drone Type: {0} - Tier: {1}'.format(
        mydrone1.dtype, mydrone1.dtier))
    time.sleep(0.3)
    print('Drone Bay [2] Status - Drone Type: {0} - Tier: {1}'.format(
        mydrone2.dtype, mydrone2.dtier))
    time.sleep(0.2)
    print('Drone Bay [3] Status - Drone Type: {0} - Tier: {1}'.format(
        mydrone3.dtype, mydrone3.dtier))

    dronesel = pyip.inputMenu(['Bay 1', 'Bay 2', 'Bay 3'],
                              numbered=True,
                              prompt='\nDrone to deploy to nearby ship:\n')
    if dronesel == 'Bay 1':
        dronetype = mydrone1.dtype
    if dronesel == 'Bay 2':
        dronetype = mydrone2.dtype
    if dronesel == 'Bay 3':
        dronetype = mydrone3.dtype
示例#13
0
    def user_menu(self) -> None:
        """
        User can chose between creating a new sql table or enter an exisiting one
        """

        menuArr = ["Create a new user",
            "Already have a username",
            "QUIT"]
        print('=' * 20 + ' USER ' + '=' * 20)
        option = pyip.inputMenu(menuArr, numbered=True)

        # If the user wants to create a new user/new sql table 
        if option == menuArr[0]:
            self.create_user_config()
        # If the user already has a sql table
        if option == menuArr[1]:
            self.existing_user()
        # If the user wants to quit
        if option == menuArr[-1]:
            sys.exit()
        print('Setup Complete')
        time.sleep(1)
        clear.clear()
示例#14
0
def ajout_log(args) -> None:
    """crée le log"""
    typemessage = ajout_type(args.type)
    utilisateur = verifier_user(args.utilisateur)
    message = ' '.join(args.message)
    if len(args.message) == 0:
        message = pyin.inputStr(prompt=Fore.BLUE + "Message: \n" + Fore.RESET,
                                limit=5)
        promp = (Fore.BLUE + "Type[" + Fore.YELLOW + "1" + Fore.BLUE + "]:\n" +
                 Fore.RESET)
        typemessage = pyin.inputMenu(OPTION_TYPE_MESSAGE,
                                     prompt=promp,
                                     numbered=True,
                                     blank=True)
        promp = (Fore.BLUE + "Utilisateur [" + Fore.YELLOW +
                 getpass.getuser() + Fore.BLUE + "]: \n" + Fore.RESET)
        utilisateur = pyin.inputStr(prompt=promp,
                                    blank=True,
                                    blockRegexes=[(REGEX_CHAR_INVALIDE,
                                                   MESSAGE_INVALIDE),
                                                  (REGEX_TAB, MESSAGE_INVALIDE)
                                                  ])
    print_log(typemessage, message, utilisateur)
示例#15
0
def view_sheet(workbook, chosen_sheet=None):
    openbook = openpyxl.load_workbook(workbook)
    sheets = openbook.sheetnames
    if chosen_sheet == None:
        ##    option = inputYesNo() #still add
        if len(sheets) >= 2:
            chosen_sheet = pyip.inputMenu(sheets, numbered=True)
        elif len(sheets) == 1:
            chosen_sheet = sheets[0]
        else:
            print('N/A')

    #row is vertical, column is horizontale
    items = []
    rows = openbook[chosen_sheet].max_column  #horizontal
    columns = openbook[chosen_sheet].max_row  #vertical

    for i in range(1, columns + 1):  #y
        row_items = []
        row_items.append(str(i))
        for j in range(1, rows + 1):  #x
            row_items.append(openbook[chosen_sheet].cell(column = j,\
                                                     row = i).value)
        items.append(row_items)
    #to display the items there
    table = PrettyTable()
    table.field_names = ['Row/Column'] + [a for a in range(1, rows + 1)]
    for i in items:
        table.add_row(i)


##    sort = pyip.inputYesNo('Sort?[Y/N]')
##    if sort == 'yes':
##        category =
##        table.sortby =
    print('File name:%s\nSheet name:%s' % (workbook, chosen_sheet))
    print(table)
示例#16
0
def cho_han():
    global money
    bet = pyip.inputInt(
        prompt=
        "We\'re playing cho han now. You need to guess whether the sum of two dice is odd or "
        "even. Please make your bet.\n",
        min=1,
        max=money)
    guess = pyip.inputMenu(
        choices=['Odd', 'Even'],
        prompt="What\'s your guess? Enter either Odd or Even.\n")
    print("Your guess is {} and your bet is {}$. Rolling the dice!".format(
        guess, bet))
    time.sleep(1)
    money -= bet
    win = 2 * bet
    loss = -bet
    dice1 = random.randint(1, 6)
    dice2 = random.randint(1, 6)
    dice_sum = dice1 + dice2
    if (dice_sum % 2 == 1) and (guess == 'Odd'):
        money += win
        print(
            "Congratulations, the sum is {} and it is odd! You won {}. Your balance is {}."
            .format(dice_sum, win, money))
        time.sleep(1)
    elif (dice_sum % 2 == 0) and (guess == 'Even'):
        money += win
        print(
            "Congratulations, the sum is {} and it is even! You won {}. Your balance is {}"
            .format(dice_sum, win, money))
        time.sleep(1)
    else:
        print(
            "You lost this time. The sum is {} and it is not {}. Amount of your loss is {}. Your balance is "
            "{}.".format(dice_sum, guess, loss, money))
        time.sleep(1)
示例#17
0
def iterator_wrapper(iterator):
    flag_httpresponse_code_429 = False
    while True:
        try:
            iterator,iterator_copy = itertools.tee(iterator)
            iterator_value = next(iterator)
            yield (iterator_value,None)
            flag_httpresponse_code_429 = False
        except StopIteration as e_stop:
            yield (None,e_stop)
        except azure.core.exceptions.HttpResponseError as e_http:
            if e_http.status_code == 429:
               wait_time = int(e_http.response.headers["Retry-After"]) + 10
               print("[!] Encounter throttling limits error. In order to continue the scan, you need to wait {} min".format(wait_time) ,flush=True)
               response = pyip.inputMenu(['N', 'Y'],"Do you wish to wait {} min ? or stop the scan here and recieve the script outcome till this part\nEnter Y for Yes, Continue the scan\nEnter N for No, Stop the scan \n".format(wait_time))              
             
               if response == 'Y':
                   print("[!] {} min timer started".format(wait_time), flush=True)
                   time.sleep(wait_time)
               else:
                   yield (STOP_SCAN_FLAG, None)
           
               if flag_httpresponse_code_429:
                   # This means this current iterable object got throttling limit 2 times in a row, this condition has been added in order to prevent an infinite loop of throttling limit.
                   print("[!] The current object we have been trying to access has triggered throttling limit error 2 times in a row, skipping this object ", flush=True)
                   flag_httpresponse_code_429 = False
                   yield (None,e_http)
               else:
                   flag_httpresponse_code_429 = True
                   iterator = iterator_copy
                   continue
                
            else:
                yield (None,e_http)
        except Exception as e:
            yield (None,e)      
示例#18
0
def entry():
    # Loop to generate expense entries according to date, type of expense, category & price
    date = pyip.inputDate(prompt='Date of expense: ', formats=['%d/%m/%Y'])
    entry_dict["date"] = date

    expense: str = input("What was the expense for? ")
    entry_dict["item"] = expense

    print("Choose a category: (write the category name)")
    spend_cat = list(dict.keys(categories))
    choice_cat = pyip.inputMenu(spend_cat, numbered=True)
    entry_dict["category"] = choice_cat

    cost = pyip.inputFloat(prompt='Cost: ')
    entry_dict["cost"] = cost
    print("\n")

    transactions.append(list(entry_dict.items()))

    # Check if categories match. If they match, deduce purchase amount from category budget
    if entry_dict["category"] in categories.keys():
        check_cats = entry_dict["category"]
        categories[check_cats] = categories[check_cats] - transactions[-1][3][1]

        
    print("\n")

    # Print transaction entry
    for key, value in entry_dict.items():
        print(key, ' : ', value)

    print("\n")

    # Print updated category budgets
    for key, value in categories.items():
        print(key, ' : ', value)
示例#19
0
def main():
    if not os.path.isdir("Melodies"):
        os.mkdir("Melodies")

    menu_items = [
        "Note Practice", "Chord Practice", "Scale Practice",
        "Melody Generation", "Melody Generation with Chords"
    ]
    menu_choice = pyip.inputMenu(menu_items,
                                 numbered=True,
                                 allowRegexes=[r"1|2|3|4|5|q"])

    try:
        menu_choice = assign_index_input(menu_choice, menu_items)
    except:
        pass

    if menu_choice is "q":
        exit()

    if menu_choice is menu_items[0]:
        note_practice()
    elif menu_choice is menu_items[1]:
        chord_practice()
    elif menu_choice is menu_items[2]:
        scale_practice()
    elif menu_choice is menu_items[3]:
        melodies_to_generate = pyip.inputInt(
            prompt="How many melodies do you want to generate? ", min=1)
        generate_melody(False, repetitions=melodies_to_generate)
    elif menu_choice is menu_items[4]:
        melodies_to_generate = pyip.inputInt(
            prompt="How many melodies do you want to generate? ", min=1)
        generate_melody(True, repetitions=melodies_to_generate)

    main()
# Create your custom sandwich program
# Done

import pyinputplus as pyip

# create custom sandwich
bread_type = pyip.inputMenu(['wheat', 'white', 'sourdough'], numbered=True)
protein_type = pyip.inputMenu(['chicken', 'turkey', 'ham', 'tofu'],
                              numbered=True)
cheese = pyip.inputYesNo('Would you like some cheese? ')
cheese_type = ''
if cheese == 'yes':
    cheese_type = pyip.inputMenu(['cheddar', 'Swiss', 'mozzarella'],
                                 numbered=True)
extra = pyip.inputYesNo(
    'Would you like some mayo / mustard / lettuce / tomato? ')
extra_type = ''
if extra == 'yes':
    extra_type = pyip.inputMenu(['mayo', 'mustard', 'lettuce', 'tomato'],
                                numbered=True)
sandwich_count = pyip.inputInt('How many of these sandwiches would you like? ',
                               min=1)

# add custom sandwich to the order list
order = [bread_type, protein_type]
if cheese_type:
    order.append(cheese_type)
if extra_type:
    order.append(extra_type)

# define store prices
示例#21
0
import pyinputplus as pyip
total = 0
bread = pyip.inputMenu(['wheat', 'white', 'sourdough'], numbered=True)
protein = pyip.inputMenu(['chicken', 'turkey', 'ham', 'tofu'], numbered=True)
cheese = pyip.inputYesNo('Would you like cheese on that?\n')
if cheese == 'yes':
    cheeseType = pyip.inputMenu(['cheddar', 'swiss', 'mozzarella'],
                                numbered=True)

mayo = pyip.inputYesNo('Would you like mayo on that?\n')
mustard = pyip.inputYesNo('Would you like mustard on that?\n')
lettuce = pyip.inputYesNo('Would you like lettuce on that?\n')
tomato = pyip.inputYesNo('Would you like tomato on that?\n')
quantity = pyip.inputInt('How many sandwiches would you like?\n')

order = [bread, protein, cheese, mayo, mustard, lettuce, tomato]
total += float(5.50)  # base price of sandwich
if order[2] == 'yes':
    total += 1.00  # upcharge for cheese
if order[3] == 'yes':
    total += 0.25  # upcharge for mayo
if order[4] == 'yes':
    total += 0.25  # upcharge for mustard
if order[5] == 'yes':
    total += 0.25  # upcharge for lettuce
if order[6] == 'yes':
    total += 0.25  # upcharge for tomato
print('Your total is:')
print(total * quantity)
import pyinputplus as pyip

prompt_welcome = "Welcome to the Sandwich Maker :) \n"

print(prompt_welcome)
bread = pyip.inputChoice(["wheat", "white", "sourdough"])
protein = pyip.inputChoice(["chicken", "turkey", "ham", "tofu"])

want_cheese = pyip.inputYesNo(prompt="Do you want cheese?\n")
if want_cheese == "yes":
    cheese = pyip.inputMenu(["cheddar", "Swiss", "mozzarella"])

want_mayo = pyip.inputYesNo(prompt="Do you want mayo?\n")
want_mustard = pyip.inputYesNo(prompt="Do you want mustard?\n")
want_lettuce = pyip.inputYesNo(prompt="Do you want lettuce?\n")
want_tomato = pyip.inputYesNo(prompt="Do you want tomato?\n")

mayo = "mayo" if want_mayo else "empty"
mustard = "mustard" if want_mustard else "empty"
lettuce = "lettuce" if want_lettuce else "empty"
tomato = "tomato" if want_tomato else "empty"

nr_sandwiches = pyip.inputInt(prompt="How many ssandwhiches do you want?\n")

sandwich = [bread, protein, cheese, mayo, mustard, lettuce, tomato]
prices = {
    "wheat": 0.75,
    "white": 0.69,
    "sourdough": 0.82,
    "chicken": 1.4,
示例#23
0
import pyinputplus as pyin

breadType = {'wheat': 30, 'white': 40, 'sourdough': 50}
proteinType = {'Chicken': 30, 'Turkey': 40, 'Ham': 50, 'Tofu': 60}
cheeseType = {'Cheddar': 5, 'Swiss': 10, 'Mozzarella': 20}
veggieType = {'Lettuce': 2, 'Mayo': 3, 'Mustard': 4, 'Tomato': 5}
orderList = []

print("WELCOME TO LA CASA BELLE")
print("Select Bread Type")
breadResponse = pyin.inputMenu(['Wheat', 'White', 'Sourdough'],
                               default='Wheat')
orderList.append(breadResponse)
print("Select Protein Type")
proteinResponse = pyin.inputMenu(['Chicken', 'Turkey', 'Ham', 'Tofu'],
                                 default='Chicken')
orderList.append(proteinResponse)
print("Do you want Cheese")
cheeseChoice = pyin.inputYesNo()
print(cheeseChoice)
if cheeseChoice == 'yes':
    print("Select Cheese Type")
    cheeseType = pyin.inputMenu(['Cheddar', 'Swiss', 'Mozzarella'])
    orderList.append(cheeseType)
else:
    print("You have selected no Cheese")

print("Do you want Mayo?")
mayoChoice = pyin.inputYesNo()
if mayoChoice == 'yes':
    orderList.append('Mayo')
pricing = {
    'wheat': 8,
    'white': 9,
    'sourdough': 10,
    'chicken': 15,
    'ham': 20,
    'turkey': 25,
    'tofu': 10,
    'cheddar': 8,
    'swiss': 10,
    'mozzarella': 12
}
price = 0

bread = ['wheat', 'white', 'sourdough']
protein = ['chicken', 'turkey', 'ham', 'tofu']
cheese = ['cheddar', 'swiss', 'mozzarella']
chooseB = pyip.inputMenu(bread)
chooseP = pyip.inputMenu(protein)
wantC = pyip.inputYesNo(prompt='Do you want cheese')
if wantC == 'yes':
    chooseC = pyip.inputMenu(cheese)
    price += pricing.get(chooseC)
number = pyip.inputInt(prompt='How many sandwitches you want?')

price += pricing.get(chooseB)
price += pricing.get(chooseP)
price = price * number

print('The price for you sandwitch(s) is/are: %s' % price)
import time

breadType = {'wheat': 1.50, 'white': 1.50, 'sourdough': 2.00, 'no bread': 0}
proteinType = {
    'chicken': 2.50,
    'turkey': 2,
    'ham': 3.50,
    'tofu': 3,
    'no protein': 0
}
cheeseType = {'cheddar': 1, 'Swiss': 1, 'mozzarella': 1}

print('Welcome to the sandwich bar, please tell me your choices!', end='\n')

#Using inputMenu() for a bread type: wheat, white, or sourdough.
bread = pyip.inputMenu(list(breadType), lettered=True)

#Using inputMenu() for a protein type: chicken, turkey, ham, or tofu.
protein = pyip.inputMenu(list(proteinType), lettered=True)

#Using inputYesNo() to ask if they want cheese.
cheeseBool = pyip.inputYesNo(
    prompt='Would you like cheese on your sandwich?\n')
#If so, using inputMenu() to ask for a cheese type: cheddar, Swiss, or mozzarella.
if cheeseBool == 'yes':
    cheese = pyip.inputMenu(list(cheeseType), lettered=True)

#Using inputYesNo() to ask if they want mayo, mustard, lettuce, or tomato.
mayoBool = pyip.inputYesNo(prompt='Would you like mayo?\n')
mustardBool = pyip.inputYesNo(prompt='Would you like mustard?\n')
lettuceBool = pyip.inputYesNo(prompt='Would you like lettuce?\n')
示例#26
0
print(f"The images used will be from {os.getcwd()}")

useClass = pyip.inputYesNo(prompt="Use Class Mode? ")

allClasses = []
allClassesNames = []
sessionTime = 0
if useClass == "yes":
    classesJson = os.path.join(fileDirectory, "classes.json")
    with open(f"{classesJson}", "r") as f:
        classesContent = loads(f.read())
        for key in classesContent["allClasses"]:
            allClasses.append(classesContent["allClasses"][key])
            allClassesNames.append(key)

    chosenClass = pyip.inputMenu(allClassesNames, numbered=True)
    chosenClass = allClasses[allClassesNames.index(chosenClass)]

    for key, value in enumerate(chosenClass):
        sessionTime += chosenClass[value] * float(value)
else:
    sessionTime = pyip.inputFloat(prompt="How many minutes do you want to practice? ")
    timePerImage = pyip.inputFloat(prompt="How many minutes do you want per image: ", greaterThan=0)

sessionTimeValue = sessionTime * 60

useRecursive = pyip.inputYesNo(prompt="Use recursive search? ")
allowRepeated = pyip.inputYesNo(prompt="Allow repeated images? ")
stayOnTop = pyip.inputYesNo(prompt="Stay on top? ")

allImages = []
示例#27
0
import pyinputplus as pyip
from bot import InstagramBot
from bot import print_list

#TODO add checks for broken links/ elements not found

newBot = InstagramBot(input('Please enter your username: '******'Please enter your password: '******''
while choice != 'Logout':
    choice = pyip.inputMenu([
        'Follow user', 'Unfollow user', 'Get followers', 'Get following',
        'Get ratio', 'Like recent posts', 'Logout'
    ])
    if choice == 'Follow user':
        newBot.follow_user(input('Please enter a valid username to follow: '))
    if choice == 'Unfollow user':
        newBot.unfollow_user(
            input('Please enter a valid username to unfollow: '))
    if choice == 'Get followers':
        user = pyip.inputYesNo('Would you like to get your own followers?')
        if user == 'yes':
            print_list(newBot.followers)
        else:
            print_list(newBot.get_followers(input('Enter a valid username: '******'Get following':
        user = pyip.inputYesNo(
            'Would you like to get the accounts you are following?')
        if user == 'yes':
            print_list(newBot.following)
    'sourdough': 1.50,
    'chicken': 3,
    'turkey': 3.50,
    'ham': 3,
    'tofu': 3.50,
    'cheddar': 1,
    'swiss': 1,
    'mozzarella': 1,
    'None': 0,
    'mayo': .10,
    'mustard': .10,
    'lettuce': .30,
    'tomato': .30
}

bread = pyip.inputMenu(['white', 'wheat', 'sourdough'])
protein = pyip.inputMenu(['chicken', 'turkey', 'ham', 'tofu'])
cheese = pyip.inputYesNo(prompt='Would you like to add cheese for $1?')
if cheese == 'yes':
    cheese_choice = pyip.inputMenu(['cheddar', 'swiss', 'mozzarella'])
else:
    cheese_choice = 'None'
sandwich_ingredients = [bread, protein, cheese_choice]
for i in ['mayo', 'mustard', 'lettuce',
          'tomato']:  #can add other ingredients here
    response = pyip.inputYesNo(prompt='Would you like to add ' + i + '?')
    if response == 'yes':
        response = i
        sandwich_ingredients.append(response)
sandwich_number = pyip.inputInt(prompt='How many sandwiches would you like?',
                                min=1)
示例#29
0
        },
        "mustard": {
            "yes": .05,
            "no": 0
        },
        "lettuce": {
            "yes": .05,
            "no": 0
        },
        "tomato": {
            "yes": .05,
            "no": 0
        }
    }

    my_bread = pyip.inputMenu(list(price_dic["bread"]))
    my_protien = pyip.inputMenu(list(price_dic["protien"]))
    my_yn = pyip.inputYesNo("Would You Like Cheese : ")
    if my_yn == "yes":
        my_cheese = pyip.inputMenu(list(price_dic["cheese"]))
        cost = price_dic["cheese"][my_cheese]
    else:
        cost = 0
    my_mayo = pyip.inputYesNo("Would You Like Mayo : ")
    my_mustard = pyip.inputYesNo("Would You Like Mustard : ")
    my_lettuce = pyip.inputYesNo("Would You Like Lettuce : ")
    my_tomato = pyip.inputYesNo("Would You Like Tomato : ")

    cost += (price_dic["bread"][my_bread] + price_dic["protien"][my_protien] +
             price_dic["tomato"][my_tomato] + price_dic["mayo"][my_mayo] +
             price_dic["mustard"][my_mustard] +
示例#30
0
    'mustard': 0.2,
    'lettuce': 0.1,
    'tomato': 0.3,
}


def add_to_order(product):
    """Choose from option and add to order."""
    question = pyip.inputYesNo(f'Do you want {product}?\n')
    if question == 'yes':
        order.append(product)


order = []
check = []
order.append(pyip.inputMenu(['wheat', 'white', 'sourdough']))
order.append(pyip.inputMenu(['chicken', 'turkey', 'ham', 'tofu']))
cheese = pyip.inputYesNo(prompt='Do you want cheese? y/n\n')
if cheese == 'yes':
    order.append(pyip.inputMenu(['cheddar', 'Swiss', 'mozzarella']))
add_to_order('mayo')
add_to_order('mustard')
add_to_order('lettuce')
add_to_order('tomato')
number = pyip.inputInt(prompt='How many sandwiches?\n', min=1)

for item in order:
    check.append(PRICES[item])
    print(f'Product: {item.title()}, Price: {PRICES[item]}')

print(f'Number of sandwiches: {number}')