- Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTkinter_GUI.py
92 lines (69 loc) · 2.49 KB
/
Tkinter_GUI.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
fromtkinterimport*
window=Tk()
window.title("ItsExceptional")
window.geometry("300x200")
window.config(background="black", pady=10)
lb1=Label(window, text="Login Form", bg="black", fg="white", font=20)
lb1.place(x=110, y=5)
lb2_u=Label(window, text="Username - ", bg="black", fg="white")
lb2_u2=Entry(window)
lb2_u.place(x=10, y=40)
lb2_u2.place(x=110, y=40)
lb2_p=Label(window, text="Password - ", bg="black", fg="white")
lb2_p2=Entry(window)
lb2_p.place(x=10, y=80)
lb2_p2.place(x=110,y=80)
display=Label(window, text="Access : ", bg="black")
bt=Button(window, text="Login")
defdis():
user=lb2_u2.get()
pas=lb2_p2.get()
filo=open('register.txt').readlines()
forlinoinfilo:
ifuser==lino.split()[2]:
display.config(bg="green",fg="white", text="Access :Granted")
break
else:
display.config(bg="red",fg="white", text="Access :Denied")
bt.config(command=dis)
bt.place(x=110, y=120)
defnewsign():
sign=Tk()
sign.title("SignUp")
sign.geometry("300x200")
sign.config(background="black", pady=10)
lbs=Label(sign, text="SignUp", bg="black", fg="white", font=20)
lbs.place(x=110, y=5)
lb2_s=Label(sign, text="Username - ", bg="black", fg="white")
lb2_s2=Entry(sign)
lb2_s.place(x=10, y=40)
lb2_s2.place(x=110, y=40)
lb2_ps=Label(sign, text="Password - ", bg="black", fg="white")
lb2_ps2=Entry(sign)
lb2_ps.place(x=10, y=80)
lb2_ps2.place(x=110,y=80)
dis=Label(sign, text="", bg="black", fg="white")
defreg():
username=lb2_s2.get()
pas=lb2_ps2.get()
file=open("register.txt","a")
fiIn=open('register.txt').readlines()
l=[]
forlinesinfiIn:
l.append(lines.split()[1])
ifusernameinl:
print("Exists")
dis.config(text="User Exists", bg="green")
else:
print("not Exists")
file.write("Username = "+username+"\n")
file.write("Password = "+pas+"\n")
file.close()
dis.config(text="Registered", bg="green")
bts=Button(sign, text="Register", command=reg)
bts.place(x=110, y=120)
dis.place(x=100, y=150)
window.destroy()
bt2=Button(window, text="SignUp", command=newsign)
bt2.place(x=170, y=120)
display.place(x=110, y=155)