-
Notifications
You must be signed in to change notification settings - Fork 8
/
delete_database.py
38 lines (27 loc) · 915 Bytes
/
delete_database.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
import sqlite3
from tkinter import *
import os
conn = sqlite3.connect('database/database.db')
c = conn.cursor()
#taking input from user
root = Tk()
root.title("Deleting Database")
uid = Label(root, text="Enter Your Unique Registration Id: ")
uid_val = Entry(root)
uid.grid(row=0,rowspan=2,sticky=N+E+W+S)
uid_val.grid(row=0,rowspan=2,column=1,sticky=N+E+W+S)
def submit_e():
global val1
val1 = uid_val.get()
root.destroy()
submit = Button(root, text="Submit",font=("times new roman",20),bg="brown",fg='white',command=submit_e)
submit.grid(row=2,columnspan=2,sticky=N+E+S+W)
root.mainloop()
c.execute("DELETE FROM students WHERE UID = ?",(str(val1),))
conn.commit()
# writing database in excel
os.system("python writing_in_excel.py")
for file in os.listdir('dataset/'):
if (file.endswith('.jpg') and (str(val1) in file)) :
os.remove('dataset/'+file)
conn.close()