-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrm_o.py
More file actions
54 lines (45 loc) · 1.4 KB
/
rm_o.py
File metadata and controls
54 lines (45 loc) · 1.4 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
from subprocess import call
from tkinter import *
from tkinter import ttk
import tkinter
from tkinter import messagebox
from tkinter import font
import mysql.connector
#defining functions
#creating window
root = Tk()
root.geometry("600x100")
root.title("Remove Student")
#Define fontStyles
fontStyle_p = "arial 16 bold"
fontStyle_e = "arial 16"
#label of Enrollment no.
lbl1 = Label(root, text="Enter Enrollment No. :", font=fontStyle_p)
lbl1.grid(column=0, row=0)
#Entry box for Enrollment no.
enroll = StringVar()
e_enroll = Entry(root, textvariable=enroll, font=fontStyle_e)
e_enroll.grid(column=1, row=0)
#funtion to remove student from the database
def remove():
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="attendance"
)
mycursor = mydb.cursor()
query = "DELETE FROM mTech_o WHERE sEnroll=%s"
sEnroll = enroll.get()
values = (sEnroll,)
mycursor.execute(query, values)
mydb.commit()
messagebox.showinfo("Student Removed", "Student Removed Successfully!")
root.destroy()
#blank row
blank = Label(root, text="").grid(column=0, row=3)
#student remove button
submit = Button(root, text="Remove Student", command=lambda:remove())
submit.configure(font=('arial', 14, 'bold'), bg='red', fg='white')
submit.grid(column=1, row=4)
root.mainloop()