-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_tenant.py
201 lines (100 loc) · 5.13 KB
/
add_tenant.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
from tkinter import *
from tkinter import messagebox
import pymysql
add = Tk()
add.title("dashboard")
add.geometry('990x660+50+50')
def abc():
try:
con=pymysql.connect(host='localhost',user='root',password='satyam@4545')
mycursor=con.cursor()
print(con)
except:
messagebox.showerror('Error','connection failed')
return
try:
query='use userdata'
mycursor.execute(query)
query='create table adres2(id int auto_increment primary key not null, name varchar(100),adhar varchar(100),mob varchar(100),appartment varchar(100),home varchar(100),flat varchar(100),deposit varchar(100))'
mycursor.execute(query)
except:
query='use userdata'
mycursor.execute(query)
query='insert into adres2(name,adhar,mob,appartment,home,flat,deposit) values(%s,%s,%s,%s,%s,%s,%s)'
mycursor.execute(query,(addEntry.get(),adhEntry.get(),mobEntry.get(),appEntry.get(),homEntry.get(),flatEntry.get(),depEntry.get()))
messagebox.showinfo('successful','appartment is registered')
con.commit()
con.close()
def back():
import dashboard_App_A_4
add.destroy()
def user_add(event): # event is a variable which accepts the value passed by the on_enter function
if addEntry.get()=='Enter name':
addEntry.delete(0,END)
def user_adh(event): # event is a variable which accepts the value passed by the on_enter function
if adhEntry.get()=='enter adhar no':
adhEntry.delete(0,END)
def user_mob(event): # event is a variable which accepts the value passed by the on_enter function
if mobEntry.get()=='enter mobile no':
mobEntry.delete(0,END)
def user_hom(event): # event is a variable which accepts the value passed by the on_enter function
if homEntry.get()=='enter home town ':
homEntry.delete(0,END)
def user_app(event): # event is a variable which accepts the value passed by the on_enter function
if appEntry.get()=='enter appartment ':
appEntry.delete(0,END)
def user_agg(event): # event is a variable which accepts the value passed by the on_enter function
if aggEntry.get()=='upload aggrement ':
aggEntry.delete(0,END)
def user_flat(event): # event is a variable which accepts the value passed by the on_enter function
if flatEntry.get()=='enter flat no ':
flatEntry.delete(0,END)
def user_dep(event): # event is a variable which accepts the value passed by the on_enter function
if depEntry.get()=='enter deposit amount ':
depEntry.delete(0,END)
def user_img(event): # event is a variable which accepts the value passed by the on_enter function
if imgEntry.get()=='upload image ':
imgEntry.delete(0,END)
Welcomelabel=Label(add,text='ADD TENANT',font=('Microsoft Yahei UI Light',35,'bold'))
Welcomelabel.place(x=290,y=50)
addEntry=Entry(add,text='Enter name',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
addEntry.place(x=20,y=270)
addEntry.insert(0,'Enter name')
addEntry.bind('<FocusIn>',user_add)
adhEntry=Entry(add,text='enter adhar no',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
adhEntry.place(x=400,y=270)
adhEntry.insert(0,'enter adhar no')
adhEntry.bind('<FocusIn>',user_adh)
mobEntry=Entry(add,text='enter mobile no',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
mobEntry.place(x=800,y=270)
mobEntry.insert(0,'enter mobile no')
mobEntry.bind('<FocusIn>',user_mob)
homEntry=Entry(add,text='enter home town ',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
homEntry.place(x=20,y=410)
homEntry.insert(0,'enter home town ')
homEntry.bind('<FocusIn>',user_hom)
appEntry=Entry(add,text='enter appartment ',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
appEntry.place(x=800,y=610)
appEntry.insert(0,'enter appartment ')
appEntry.bind('<FocusIn>',user_app)
aggEntry=Entry(add,text='upload aggrement ',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
aggEntry.place(x=400,y=610)
aggEntry.insert(0,'upload aggrement ')
aggEntry.bind('<FocusIn>',user_agg)
flatEntry=Entry(add,text='enter flat no ',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
flatEntry.place(x=20,y=610)
flatEntry.insert(0,'enter flat no ')
flatEntry.bind('<FocusIn>',user_flat)
depEntry=Entry(add,text='enter deposit amount ',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
depEntry.place(x=400,y=410)
depEntry.insert(0,'enter deposit amount ')
depEntry.bind('<FocusIn>',user_dep)
imgEntry=Entry(add,text='upload image ',width=18,font=('Microsoft Yahei UI Light',18,'bold'))
imgEntry.place(x=800,y=410)
imgEntry.insert(0,'upload image ')
imgEntry.bind('<FocusIn>',user_img)
addButton=Button(add,text='add',font=('Microsoft Yahei UI Light',18,'bold'),command=abc)
addButton.place(x=890,y=50)
gobackButton=Button(add,text='go back',font=('Microsoft Yahei UI Light',18,'bold'),command=back)
gobackButton.place(x=100,y=50)
add.mainloop()