|
1 | 1 | from tkinter import *
|
2 | 2 | import pymongo
|
| 3 | +import time |
3 | 4 | myclient = pymongo.MongoClient(
|
4 | 5 | "mongodb+srv://CodingBlood:[email protected]/myFirstDatabase?retryWrites=true&w=majority")
|
5 | 6 | mydb = myclient["Chatbox"]
|
6 | 7 | mycol = mydb["UserDetails"]
|
7 | 8 | def main():
|
8 | 9 | def some():
|
9 |
| - # global userid |
10 |
| - # global paswrd |
11 | 10 | name = userid.get()
|
12 | 11 | pass_wrd = paswrd.get()
|
13 | 12 | myquery = {"UName": name}
|
14 | 13 | mydoc = mycol.find(myquery)
|
15 | 14 | for x in mydoc:
|
16 | 15 | if x["UPassword"] == pass_wrd:
|
17 | 16 | print("Login Successful")
|
18 |
| - # Button(root1, text="Login Successful Click To Proceed", width=100, height=2, bd=5,) |
| 17 | + l1.destroy() |
| 18 | + l2.destroy() |
| 19 | + l3.destroy() |
| 20 | + l4.destroy() |
| 21 | + b1.destroy() |
| 22 | + sb1 = Button(root1, text=' Global Chat', bg=color["nero"], fg=color["orange"], |
| 23 | + font=('Malgun Gothic Semilight', 25, "bold"), width=500, height=100, bd=5, image=login, |
| 24 | + compound=LEFT, |
| 25 | + anchor="nw", command=some) |
| 26 | + # canvas1.create_text(100, 245, "Username", width=50, height=1, fg=color["orange"]) |
| 27 | + sl1 = Button(root1, text=' Public Chat Groups', bg=color["nero"], fg=color["orange"], |
| 28 | + font=('Malgun Gothic Semilight', 25, "bold"), width=500, height=100, bd=5, image=login, |
| 29 | + compound=LEFT, |
| 30 | + anchor="nw", command=some) |
| 31 | + sl2 = Button(root1, text=' Private Chat Groups', bg=color["nero"], fg=color["orange"], |
| 32 | + font=('Malgun Gothic Semilight', 25, "bold"), width=500, height=100, bd=5, image=login, |
| 33 | + compound=LEFT, |
| 34 | + anchor="nw", command=some) |
| 35 | + sl3 = Button(root1, text=' New Public Group', bg=color["nero"], fg=color["orange"], |
| 36 | + font=('Malgun Gothic Semilight', 25, "bold"), width=500, height=100, bd=5, image=login, |
| 37 | + compound=LEFT, |
| 38 | + anchor="nw", command=some) |
| 39 | + sl4 = Button(root1, text=' New Private Group', bg=color["nero"], fg=color["orange"], |
| 40 | + font=('Malgun Gothic Semilight', 25, "bold"), width=500, height=100, bd=5, image=login, |
| 41 | + compound=LEFT, |
| 42 | + anchor="nw", command=some) |
| 43 | + canvas1.create_window(400, 495, anchor="nw", window=sb1) |
| 44 | + canvas1.create_window(700, 245, anchor="nw", window=sl1) |
| 45 | + canvas1.create_window(700, 370, anchor="nw", window=sl2) |
| 46 | + canvas1.create_window(100, 245, anchor="nw", window=sl3) |
| 47 | + canvas1.create_window(100, 370, anchor="nw", window=sl4) |
19 | 48 | else:
|
20 | 49 | print("Login Failed")
|
21 |
| - # Button(root1, text="Login Failed Retry...", width=100, height=2, bd=5) |
22 | 50 | userid.set("")
|
23 | 51 | paswrd.set("")
|
24 | 52 | def switch():
|
@@ -88,16 +116,14 @@ def switch():
|
88 | 116 | paswrd = StringVar()
|
89 | 117 | brandLabel = Label(root1, text="", font="System 30", bg="gray17", fg="green")
|
90 | 118 | brandLabel.place(x=100, y=250)
|
91 |
| - b1 = Button(root1, text=' Login', bg=color["nero"], fg=color["orange"], |
| 119 | + b1 = Button(root1, text=' Login', bg=color["nero"], fg=color["orange"], |
92 | 120 | font=('Malgun Gothic Semilight', 25, "bold"), width=500, height=100, bd=5, image=login, compound=LEFT,
|
93 | 121 | anchor="nw", command=some)
|
94 | 122 | # canvas1.create_text(100, 245, "Username", width=50, height=1, fg=color["orange"])
|
95 | 123 | l1 = Entry(root1,font=('Malgun Gothic Semilight', 25, "bold"),bd=5, textvariable=userid)
|
96 | 124 | l2 = Entry(root1,font=('Malgun Gothic Semilight', 25, "bold"),bd=5, textvariable=paswrd, show='*')
|
97 | 125 | l3 = Label(root1, text='UserName', width=15, height=1, font=('Malgun Gothic Semilight', 25, "bold"),bd=5)
|
98 | 126 | l4 = Label(root1, text='Password', width=15, height=1, font=('Malgun Gothic Semilight', 25, "bold"),bd=5)
|
99 |
| - # e1 = Entry(l1, bd=5) |
100 |
| - # e2 = Entry(l2, bd=5) |
101 | 127 | canvas1.create_window(300, 495, anchor="nw", window=b1)
|
102 | 128 | canvas1.create_window(700, 245, anchor="nw", window=l1)
|
103 | 129 | canvas1.create_window(700, 370, anchor="nw", window=l2)
|
|
0 commit comments