-
Notifications
You must be signed in to change notification settings - Fork 2
/
ERS.py
103 lines (97 loc) · 3.77 KB
/
ERS.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
from threading import Thread
from time import strftime, ctime, sleep
from excel_export import *
from tkinter import messagebox
from tkinter import *
from datetime import datetime
from re import match
from openpyxl import load_workbook
import os
def submit_entry(entry,e):
global Person,Serial_number
#Entry Clear
e.delete(0,END)
if str(Person.get())=='OTHERS':
Serial_number+=1
time = datetime.now()
data = (entry, strftime("%I:%M:%S %p"), str(Person.get()))
listboxdata=(Serial_number,entry, strftime("%I:%M:%S %p"), str(Person.get()))
create_excel_sheet(data)
listbox.insert(0,listboxdata)
Person.set("STUDENTS")
else:
collage_pattern = r"\d{4}(PU|pu)[a-z|A-Z]{7}\d{5}"
try:
check_vaild = match(collage_pattern, entry)
if check_vaild is not None:
Serial_number += 1
time = datetime.now()
data = (entry, strftime("%I:%M:%S %p"),str(Person.get()))
listboxdata = (Serial_number, entry, strftime("%I:%M:%S %p"),str(Person.get()))
create_excel_sheet(data)
listbox.insert(0, listboxdata)
else:
raise Exception
except Exception as e:
messagebox.showerror("Warning","Invalid Registration No.")
def func(event):
global v,Entry
submit_entry(v.get(), Entry)
#clock function
def Time():
while True:
clock_label['text']= ctime()
sleep(1)
def enter(event):
submit['bg']='green'
submit['fg']='white'
def leave(event):
submit['bg']='white'
submit['fg'] = 'black'
Serial_number=0
window=Tk()
window.geometry('1280x1024')
window.title("ENTRY_RECORD_SYSTEM")
background_img1=PhotoImage(file= os.path.abspath("picture\\main.png"))
label=Label(window, image=background_img1)
#Welcome Label
Welcome_label=Label(label,text="Welcome To PU Library",bg='brown',fg='white', font=("Times 50 bold italic"),bd=5,relief=RAISED)
Welcome_label.pack(pady=10)
#Clock Frame
clock=Frame(label)
clock_label=Label(clock,bg='black',fg='red',padx=10,pady=10,font='Courier')
clock_label.pack()
clock.pack(pady=2)
time_thread= Thread(target=Time,daemon=True)
time_thread.start()
#Entry box
entry_frame=Frame(label,height=800,width=100,bd=2)
frame_image=PhotoImage(file=os.path.abspath("picture\\final.png"))
entry_label=Label(entry_frame,image=frame_image,height=800,width=100,bd=5)
enter_here=Label(entry_label,text="ENTER YOUR REGISTRATION NO:",fg='white',bg='black',bd=5,relief=RAISED,font='Courier')
v=StringVar()
Person=StringVar()
#Students and Others
Students=Radiobutton(entry_label,text='PU STUDENTS',variable=Person,value='STUDENTS',bd=3,relief=RAISED)
OTHER=Radiobutton(entry_label,text='OTHERS',variable=Person,value='OTHERS',bd=3,relief=RAISED)
Person.set('STUDENTS')
Entry=Entry(entry_label,font=('Times', 20, 'bold'),textvariable=v)
submit=Button(entry_label,text='Submit',relief=RAISED,bd=5, command=lambda:submit_entry(v.get(),Entry))
#Submit Button Bind
submit.bind('<Enter>',enter)
submit.bind('<Leave>',leave)
listbox=Listbox(entry_label)
Students.grid(row=1,column=0,pady=5,ipadx=20,padx=20)
OTHER.grid(row=1,column=2,pady=5,ipadx=25,padx=20)
listbox.grid(row=4,padx=20,pady=20,ipadx=20,ipady=10,columnspan=3)
submit.grid(row=3,pady=20,ipadx=10,columnspan=3)
Entry.grid(row=2,padx=10,pady=10,columnspan=3,ipadx=5)
enter_here.grid(row=0,padx=5,pady=35,ipadx=20,ipady=20,columnspan=3)
entry_label.pack(expand=YES,fill=BOTH)
entry_frame.pack(expand=YES,fill=Y,pady=10)
#Developed by
Developed_Label=Label(label,text='Developed By: PURVANSH SINGH (PIET18CS112)',fg='white',bg='black',bd=5,relief=RAISED,font='systemfixed 11')
Developed_Label.pack(side=LEFT,ipadx=5,ipady=5)
label.pack(expand=YES,fill=BOTH)
window.bind('<Return>', func)
window.mainloop()