-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUI with Tkinter
56 lines (52 loc) · 1.4 KB
/
UI with Tkinter
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
from tkinter import *
import csv
import datetime
import uuid
g=[]
def push():
a=e1.get()
b=e2.get()
c=e3.get()
d=e4.get()
ts = datetime.datetime.now()
k=ts.strftime("%Y-%m-%d %H:%M:%S")
print(k)
f=uuid.uuid1()
e=[a,b,c,d,k,f]
g.append(e)
filename = "second.csv"
with open(filename, 'a') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow(e)
def search():
sea=e5.get()
for i in range(len(g)):
if(g[i][0]==sea):
print(g[i])
f=open(filename,'w')
master = Tk()
Label(master, text='Name').grid(row=0)
Label(master, text='Mobile Number').grid(row=1)
Label(master, text='Email').grid(row=2)
Label(master, text='Institution').grid(row=3)
e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master)
e4 = Entry(master)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
e4.grid(row=3, column=1)
filename = "second.csv"
field=['Name','Mobile number','email','Institute','timestamp','uuid']
with open(filename, 'a') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow(field)
button = Button(master, text='Submit', width=25, command=push)
button.grid(row=4,column=1)
Label(master, text='Enter the name to search').grid(row=5)
e5 = Entry(master)
e5.grid(row=5, column=1)
button = Button(master, text='Search', width=25,command=search)
button.grid(row=6,column=1)
mainloop()