from tkinter import* root = Tk() # вікно користувача root.title('Розмінник') root.geometry('420x320') canvas = Canvas(root, width=620, height=320, bg='#233') # полотно a = Label(root, text = 'Введіть суму грошей:') # напис a.place(x=0, y =20) entry_a = Entry(root) # поле для введення даних entry_a.place(x=150, y = 20) def roz(entry_a): # обчислення та виведення результатів try: b = float(entry_a)//50 c = float(entry_a) % 50 d = float(c) // 20 l = float(c) % 20 m = float(l) // 5 n = float(l) % 5 t = float(n) // 2 y = float(n) % 2 fh = Label(root, text='Кількість купюр по 50 = ' + str(int(b))) fh.place(x=150, y=80) te = Label(root, text='Кількість купюр по 20 = ' + str(int(d))) te.place(x=150, y=110) ff = Label(root, text='Кількість купюр по 5 = ' + str(int(m))) ff.place(x=150, y=140) tw = Label(root, text='Кількість купюр по 2 = ' + str(int(t))) tw.place(x=150, y=170) ost = Label(root, text='Остача =' + str(round(float(y), 2))) ost.place(x=150, y=200) except ValueError : error = Label(root, text = 'Будь ласка, введіть число.') error.place(x=300, y=20) btn_calc = Button(root, text='Розміняти', bg = '#789') # кнопка btn_calc.bind('', lambda event: roz(entry_a.get())) btn_calc.place(x=150, y=50) canvas.pack() root.mainloop()