-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMS_GUI.py
More file actions
122 lines (95 loc) · 3.87 KB
/
CMS_GUI.py
File metadata and controls
122 lines (95 loc) · 3.87 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
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
import CMS_OOPS
from tkinter import *
from tkinter import messagebox
def btnAddClick():
cus=CMS.Customer()
cus.id=varid.get()
cus.age=varage.get()
cus.name=varname.get()
cus.addCostumer()
messagebox.showinfo("CMS","Customer Added Successfully")
varid.set("")
varage.set("")
varname.set("")
def btnSearchClick():
cus=CMS.Customer()
cus.id=varid.get()
cus.searchCostumer()
varage.set(cus.age)
varname.set(cus.name)
messagebox.showinfo("CMS", "Search Successful")
def btnDeleteClick():
cus=CMS.Customer()
cus.id=varid.get()
cus.deleteCostumer()
messagebox.showinfo("CMS", "Customer Deleted Successfully")
varname.set("")
varage.set("")
varname.set("")
def btnModifyCLick():
cus = CMS.Customer()
cus.id = varid.get()
cus.age = varage.get()
cus.name = varname.get()
cus.modifyCostumer()
messagebox.showinfo("CMS", "Customer Modified Successfully")
varname.set("")
varage.set("")
varname.set("")
def btnDisplayClick():
root1=Tk()
lablid1 = Label(root1, text="Customer Id:", font=1,bg="light Blue",width=20)
lablid1.grid(row=0, column=0, padx=2, pady=2)
lablage1 = Label(root1, text="Customer Age:", font=1,bg="lightBlue",width=20)
lablage1.grid(row=0, column=1, padx=2, pady=2)
lablname1 = Label(root1, text="Customer Name:", font=1,bg="light Blue",width=20)
lablname1.grid(row=0, column=2, padx=2, pady=2)
i=1
for e in CMS.Customer.cuslist:
lablid2 = Label(root1, text=f"{e.id}", font=1, bg="Yellow", width=20)
lablid2.grid(row=i, column=0, padx=2, pady=2)
lablage2 = Label(root1, text=f"{e.age}", font=1, bg="Yellow", width=20)
lablage2.grid(row=i, column=1, padx=2, pady=2)
lablname2 = Label(root1, text=f"{e.name}", font=1, bg="Yellow", width=20)
lablname2.grid(row=i, column=2, padx=2, pady=2)
i+=1
def btnSaveClick():
cus = CMS.Customer()
cus.savetoPickle()
messagebox.showinfo("CMS", "Saved Successfully")
def btnLoadClick():
cus = CMS.Customer()
cus.loadfromPickle()
messagebox.showinfo("CMS", "Loaded Successfully")
root = Tk()
root.geometry("500x400")
lablid = Label(root, text="Enter Cust Id:", font=1)
lablid.grid(row=0, column=0,padx=2,pady=2)
lablage = Label(root, text="Enter Cust Age:", font=1)
lablage.grid(row=1, column=0,padx=2,pady=2)
lablname = Label(root, text="Enter Cust Name:", font=1)
lablname.grid(row=2, column=0,padx=2,pady=2)
varid = StringVar()
entrid = Entry(root, textvariable=varid, font=1)
entrid.grid(row=0, column=1,padx=2,pady=2)
varage = StringVar()
entrage = Entry(root, textvariable=varage, font=1)
entrage.grid(row=1, column=1,padx=2,pady=2)
varname = StringVar()
entrname = Entry(root, textvariable=varname, font=1)
entrname.grid(row=2, column=1,padx=2,pady=2)
btnaddcust = Button(root, text="Add Customer", font=1, command=btnAddClick ,width=20)
btnaddcust.grid(row=3, column=0,padx=2,pady=2)
btnsearchcust = Button(root, text="Search Customer", font=1, command=btnSearchClick,width=20)
btnsearchcust.grid(row=3, column=1,padx=2,pady=2)
btndeletecust = Button(root, text="Delete Customer", font=1, command=btnDeleteClick,width=20)
btndeletecust.grid(row=4, column=0,padx=2,pady=2)
btnmodifycust = Button(root, text="Modify Customer", font=1, command=btnModifyCLick,width=20)
btnmodifycust.grid(row=4, column=1,padx=2,pady=2)
btnallcust = Button(root, text="All Customer", font=1, command=btnDisplayClick,width=20)
btnallcust.grid(row=5, column=0,padx=2,pady=2)
btnsave = Button(root, text="Save in Pickle", font=1, command=btnSaveClick,width=20)
btnsave.grid(row=5, column=1,padx=2,pady=2)
btnload = Button(root, text="Load from Pickle", font=1, command=btnLoadClick,width=20)
btnload.grid(row=6, column=1,padx=2,pady=2)
root.mainloop()