-
Notifications
You must be signed in to change notification settings - Fork 0
/
price.py
184 lines (144 loc) · 5.62 KB
/
price.py
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
from tkinter import*
import tkinter.messagebox
left1 = Tk()
left1.geometry("1600x800+0+0")
left1.title("Modify Price")
label4 = Label(left1, font = ('calibri',50,'bold'), text ="Change Price", fg = "#808000", bd = 10, anchor = 'w')
label4.grid(row = 0)
fries_inp_p = StringVar()
Sandwich_inp_p = StringVar()
burger_inp_p = StringVar()
drinks_inp_p = StringVar()
Pasta_inp_p = StringVar()
Tacos_inp_p = StringVar()
def update():
f = open('value.txt','r')
line = f.readlines()
fries_p = float(line[0])
Sandwich_p = float(line[1])
burger_p = float(line[2])
drinks_p = float(line[3])
Pasta_p = float(line[4])
Tacos_p = float(line[5])
f.close()
f2 = open('value.txt','w')
try:
CoF1 = float(fries_inp_p.get())
except Exception as e:
if fries_inp_p.get() != "":
tkinter.messagebox.showinfo('Error','Incorrect Input')
fries_inp_p.set("")
f2.write(str(fries_p)+"\n")
else:
f2.write(str(CoF1)+"\n")
try:
CoS1 = float(Sandwich_inp_p.get())
except Exception as e:
if Sandwich_inp_p.get() != "":
tkinter.messagebox.showinfo('Error','Incorrect Input')
Sandwich_inp_p.set("")
f2.write(str(Sandwich_p)+"\n")
else:
f2.write(str(CoS1)+"\n")
try:
CoB1 = float(burger_inp_p.get())
except Exception as e:
if burger_inp_p.get() != "":
tkinter.messagebox.showinfo('Error','Incorrect Input')
burger_inp_p.set("")
f2.write(str(burger_p)+"\n")
else:
f2.write(str(CoB1)+"\n")
try:
CoD1 = float(drinks_inp_p.get())
except Exception as e:
if drinks_inp_p.get() != "":
tkinter.messagebox.showinfo('Error','Incorrect Input')
drinks_inp_p.set("")
f2.write(str(drinks_p)+"\n")
else:
f2.write(str(CoD1)+"\n")
try:
CoP1 = float(Pasta_inp_p.get())
except Exception as e:
if Pasta_inp_p.get() != "":
tkinter.messagebox.showinfo('Error','Incorrect Input')
Pasta_inp_p.set("")
f2.write(str(Pasta_p)+"\n")
else:
f2.write(str(CoP1)+"\n")
try:
CoC1 = float(Tacos_inp_p.get())
except Exception as e:
if Tacos_inp_p.get() != "":
tkinter.messagebox.showinfo('Error','Incorrect Input')
Tacos_inp_p.set("")
f2.write(str(Tacos_p))
else:
f2.write(str(CoC1))
#f.write(str(Sandwich_p) +"\n"+ str(Pasta_p) +"\n"+ str(Tacos_p) +"\n"+ str(fries_p) +"\n"+ str(burger_p) +"\n"+ str(drinks_p))
tkinter.messagebox.showinfo('Update Box','Successfully Updated')
f2.close()
def reset1():
fries_inp_p.set("")
Sandwich_inp_p.set("")
burger_inp_p.set("")
drinks_inp_p.set("")
Pasta_inp_p.set("")
Tacos_inp_p.set("")
def qexit1():
left1.destroy()
def printfn():
f3 = open('value.txt','r')
liness = f3.readlines()
fries_p = float(liness[0])
Sandwich_p = float(liness[1])
burger_p = float(liness[2])
drinks_p = float(liness[3])
Pasta_p = float(liness[4])
Tacos_p = float(liness[5])
print("fry "+str(fries_p))
print("Sandwich "+str(Sandwich_p))
print("chi tikka "+str(Tacos_p))
print("Pasta "+str(Pasta_p))
print("burger "+str(burger_p))
print("drinks "+str(drinks_p))
f3.close()
def backfn():
left1.destroy()
import question
fries = Label(left1, font=('arial',16,'bold'),text = "Fries", bd = 16, anchor = 'w' )
fries.grid(row=1,column=0,sticky = E)
txt_fries = Entry(left1,font=('arial',16,'bold'), textvariable=fries_inp_p, bd=10, insertwidth =4,bg = "#f2d7d5", justify ='right')
txt_fries.grid(row=1,column=1)
Sandwich = Label(left1, font=('arial',16,'bold'),text = "Crispy Chicken Burger", bd = 16, anchor = 'w' )
Sandwich.grid(row=2,column=0,sticky = E)
txt_Sandwich = Entry(left1,font=('arial',16,'bold'), textvariable=Sandwich_inp_p, bd=10, insertwidth =4,bg = "#f2d7d5", justify ='right')
txt_Sandwich.grid(row=2,column=1)
burger = Label(left1, font=('arial',16,'bold'),text = "Mexicana Burger", bd = 16, anchor = 'w' )
burger.grid(row=3,column=0,sticky = E)
txt_burger = Entry(left1,font=('arial',16,'bold'), textvariable=burger_inp_p, bd=10, insertwidth =4,bg = "#f2d7d5", justify ='right')
txt_burger.grid(row=3,column=1)
drinks = Label(left1, font=('arial',16,'bold'),text = "Chilled Drinks", bd = 16, anchor = 'w' )
drinks.grid(row=4,column=0,sticky = E)
txt_drinks = Entry(left1,font=('arial',16,'bold'), textvariable=drinks_inp_p, bd=10, insertwidth =4,bg = "#f2d7d5", justify ='right')
txt_drinks.grid(row=4,column=1)
Pasta = Label(left1, font=('arial',16,'bold'),text = "Salad", bd = 16, anchor = 'w' )
Pasta.grid(row=5,column=0,sticky = E)
txt_Pasta = Entry(left1,font=('arial',16,'bold'), textvariable=Pasta_inp_p, bd=10, insertwidth =4,bg = "#f2d7d5", justify ='right')
txt_Pasta.grid(row=5,column=1)
Tacos = Label(left1, font=('arial',16,'bold'),text = "Chicken Wings", bd = 16, anchor = 'w' )
Tacos.grid(row=6,column=0,sticky = E)
txt_Tacos = Entry(left1,font=('arial',16,'bold'), textvariable=Tacos_inp_p, bd=10, insertwidth =4,bg = "#f2d7d5", justify ='right')
txt_Tacos.grid(row=6,column=1)
btn_update = Button(left1, padx= 16, pady= 8, bd= 16, fg= "black", font=('arial',16,'bold'), width=10, text= "Update", bg= "#f2d7d5",command = update)
btn_update.grid(row=7, column= 1)
btn_reset1 = Button(left1, padx= 16, pady= 8, bd= 16, fg= "black", font=('arial',16,'bold'), width=10, text= "Reset", bg= "#f2d7d5",command = reset1)
btn_reset1.grid(row=7, column= 2)
btn_exit1 = Button(left1, padx= 16, pady= 8, bd= 16, fg= "black", font=('arial',16,'bold'), width=10, text= "Exit", bg= "#f2d7d5",command = qexit1)
btn_exit1.grid(row=7, column= 3)
btn_print = Button(left1, padx= 16, pady= 8, bd= 16, fg= "black", font=('arial',16,'bold'), width=10, text= "Print", bg= "#f2d7d5",command = printfn)
btn_print.grid(row=7, column= 4)
btn_back = Button(left1, padx= 16, pady= 8, bd= 16, fg= "black", font=('arial',16,'bold'), width=10, text= "Back", bg= "#f2d7d5",command = backfn)
btn_back.grid(row=8, column= 3)
left1.mainloop()