-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDenomination_calculator.py
More file actions
81 lines (56 loc) · 1.98 KB
/
Copy pathDenomination_calculator.py
File metadata and controls
81 lines (56 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from tkinter import *
from tkinter import messagebox
from PIL import Image, ImageTk
root = Tk()
root.title('Denomination Counter')
root.configure(bg='light blue')
root.geometry('650x400')
upload = Image.open("app_img.jpg")
upload = upload.resize((300,300))
image = ImageTk.PhotoImage(upload)
label = Label(root,image = image,bg='light blue')
label.place(x=180,y=20)
label1 = Label(root,text = "Hey User! Welcome to Denoination Counter Aplicatin.",bg = 'light blue')
label1.place(relx = 0.5,y=340,anchor = CENTER)
def msg():
MsgBox = messagebox.showinfo("Alert","Do you want to calculate the denomination count?")
if MsgBox == 'ok':
topwin()
button1 = Button(root,text = "Let's get started!",command=msg,bg='brown',fg='white')
button1.place(x=260,y=360)
def topwin():
top = Toplevel()
top.title("Denominations Caluculator")
top.configure(bg='light grey')
top.geometry("600x350+50+50")
label =Label(top,text="Enter total amount",bg = 'light grey')
entry = Entry(top)
lbl = Label(top,text="Here are number of notes for each denomination",bg = 'light grey')
l1 = Label(top,text="500",bg ='light grey')
l2 = Label(top,text="100",bg = 'light grey')
t1 = Entry(top)
t2 = Entry(top)
def calculator():
try:
global amount
amount = int(entry.get())
note500 = amount // 500
amount %= 500
note100 = amount//100
t1.delete(0,END)
t2.delete(0,END)
t1.insert(END,str(note500))
t2.insert(END,str(note100))
except ValueError:
messagebox.showerror("Error","Please enter a valid number.")
btn = Button(top,text='calculate',command=calculator,bg='brown',fg='white')
label.place(x=230,y=50)
entry.place(x=200,y=80)
btn.place(x=240,y=120)
lbl.place(x=140,y=170)
l1.place(x=180,y=200)
l2.place(x=180,y=230)
t1.place(x=270,y=200)
t2.place(x=270,y=230)
top.mainloop()
root.mainloop()