-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
78 lines (55 loc) · 2.21 KB
/
main.py
File metadata and controls
78 lines (55 loc) · 2.21 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
'''IMporting'''
from tkinter import *
from tkinter import ttk
import tkinter.messagebox
from Options import *
class Authentication:
user = 'kcg'
passw = 'admin'
def __init__(self, root):
self.root = root
self.root.title('USER AUTHENTICATION')
'''Make Window 10X10'''
rows = 0
while rows < 10:
self.root.rowconfigure(rows, weight=1)
self.root.columnconfigure(rows, weight=1)
rows += 1
'''Username and Password'''
frame = LabelFrame(self.root, text='Login', padx=10, pady=10)
frame.grid(row=1, column=1, columnspan=10, rowspan=10)
Label(frame, text=' Username ', font=('', 14),
pady=5).grid(row=2, column=1, sticky=W)
self.username = Entry(frame)
self.username.grid(row=2, column=2)
Label(frame, text=' Password ', font=('bold', 14),
pady=5).grid(row=5, column=1, sticky=W)
self.password = Entry(frame, show='*')
self.password.grid(row=5, column=2)
# Button
ttk.Button(frame, text='LOGIN', command=self.login_user).grid(
row=7, column=2)
# ttk.Button(frame, text='FaceID(Beta)',command = self.face_unlock).grid(row=8, column=2)
'''Message Display'''
self.message = Label(text='', fg='Red')
self.message.grid(row=9, column=6)
def login_user(self):
'''Check username and password entered are correct'''
if self.username.get().strip() == self.user and self.password.get().strip() == self.passw:
# Do the work done by the main of DBMSproject.py
# Destroy current window
root.destroy()
# Open new window
newroot = Tk()
application = Options_Portal(newroot)
newroot.mainloop()
else:
'''Prompt user that either id or password is wrong'''
self.message['text'] = 'Username or Password incorrect. Try again!'
def face_unlock(self):
self.message['text'] = 'Be Patient! Developer working hard to push this feature..'
if __name__ == '__main__':
root = Tk()
root.geometry('425x185+700+300')
application = Authentication(root)
root.mainloop()