Возникает ошибка too many values to unpack (expected 2)
from tkinter import *
root = Tk()
root.geometry("400x300")
root.resizable(width=False, height=False)
def clearTextInput():
vvod.delete("1.0","end")
vivod.delete("1.0", "end")
def getTextInput():
lines = vvod.count("0.0", "end", "displaylines")[0]
result=vvod.get("1.0","end")
def deposit(arg):
name, money = arg
bank[name] = bank.setdefault(name, 0) + int(money)
def withdraw(arg):
name, money = arg
bank[name] = bank.setdefault(name, 0) - int(money)
def balance(arg):
name = arg[0]
if name in bank:
print(bank[name])
else:
print('ERROR')
def transfer(arg):
name_1, name_2, money = arg
withdraw((name_1, money))
deposit((name_2, money))
def income(arg):
percent = int(arg[0])
for name, balanse in bank.items():
if balanse > 0:
bank[name] = bank.get(name) + balanse * percent // 100
bank = {}
bank_fun = {
'DEPOSIT': deposit, 'WITHDRAW': withdraw,
'BALANCE': balance, 'TRANSFER': transfer,
'INCOME': income
}
def vivodtext():
for _ in range(lines):
data = result.split()
fun_name = data[0]
arg = data[1:]
bank_fun[fun_name](arg)
vivod.insert(1.0, vivodtext())
lbvvod = Label(text="Ввод команд")
lbvvod.grid(sticky=W, pady=3, padx=3)
lbres = Label(text="Результат")
lbres.grid(row=0, column=1, padx=5)
vvod = Text(root, width = 30, height = 15)
vvod.grid(row=1, column=0, columnspan=1, rowspan=3, padx=5)
vivod = Text(root, width = 15, height = 15)
vivod.grid(row=1, column=1, columnspan=1, rowspan=3, padx=5)
culc = Button(root, text="Calculate",
command=getTextInput)
culc.grid(row=5, column=0, padx=5)
clear = Button(root, text="Clear",
command=clearTextInput)
clear.grid(row=5, column=1)
root.mainloop()