Esempio n. 1
0
def main():
    # file_input("Pepe.txt")
    gui = input("Do you want to use the G)UI or C)onsole?: ")
    if gui == 'C':
        mode = input("Do you wish to import custom currencies via a file? (y or n): ")
        valid = False
        while not valid:
            if mode == "y":
                valid = True
                dic, new_name = file_input()
                o = input("What is your starting currency?: ")
                name = input("What do you want to convert to?: ")
                amount = float(input("How much do you want to convert?: "))
                money = Currency(o, name, amount)
                money.add_entry(new_name, dic)
                converted = money.convert()
                # money.show_rates()
                print("Converted {:,.2f} {} to {:,.2f} {}".format(amount, o, converted, name))
            elif mode == "n":
                valid = True
                original = input("What is your starting currency?: ")
                amount = float(input("How much do you want to convert?: "))
                name = input("What do you want to convert to?: ")
                money = Currency(original, name, amount)
                converted = money.convert()
                # money.show_rates()
                print("Converted {:,.2f} {} to {:,.2f} {}".format(amount, original, converted, name))
            else:
                print("Invalid choice, try again...")
                valid = False
    else:
        GUI().run()
Esempio n. 2
0
 def callback(
     instance
 ):  # I don't know what instance is but the API says to use it.
     amount = float(value.text)
     original = button_1.text
     convert_to = button_two.text
     money = Currency(original, convert_to, amount)
     number = money.convert()
     # number = float(value.text) * 2.5
     results_label.text = "{:,.2f} {}s".format(number, convert_to)
from Currency import Currency

currency = Currency()

print(currency.convert(10)) # this converts this Dollar amount to Euro. Need to figure out how to input different currency values...