|
5 | 5 | # mydb = myclient["Chatbox"]
|
6 | 6 | # mycol = mydb["UserDetails"]
|
7 | 7 | # # =========================REMEMBER IMPORTANT FOR CHATS==================================================================
|
8 |
| -# # import tkinter as tk |
9 |
| -# # |
10 |
| -# # root = tk.Tk() |
11 |
| -# # root.geometry('600x400+80+40') |
12 |
| -# # |
13 |
| -# # |
14 |
| -# # class App: |
15 |
| -# # def __init__(self, root): |
16 |
| -# # self.entry_var = tk.StringVar() |
17 |
| -# # self.entry = tk.Entry(root, textvariable=self.entry_var) |
18 |
| -# # self.entry.bind('<Return>', self.show_output) |
19 |
| -# # self.entry.pack() |
20 |
| -# # |
21 |
| -# # def show_output(self, event): |
22 |
| -# # print(self.entry_var.get()) |
23 |
| -# # |
24 |
| -# # |
25 |
| -# # App(root) |
26 |
| -# # tk.mainloop()\ |
27 |
| -# # ======================================================================================================================= |
28 |
| -# #======================================================================================================================= |
29 |
| -# |
30 |
| -# try: |
31 |
| -# from tkinter import * |
32 |
| -# except: |
33 |
| -# from tkinter import * |
34 |
| -# |
35 |
| -# class SampleApp(Tk): |
36 |
| -# def __init__(self): |
37 |
| -# Tk.__init__(self) |
38 |
| -# self.title("Chat Box") |
39 |
| -# self.geometry("1000x800") |
40 |
| -# self._frame = None |
41 |
| -# self.switch_frame(StartPage) |
42 |
| -# |
43 |
| -# def switch_frame(self, frame_class): |
44 |
| -# new_frame = frame_class(self) |
45 |
| -# if self._frame is not None: |
46 |
| -# self._frame.destroy() |
47 |
| -# self._frame = new_frame |
48 |
| -# self._frame.pack() |
49 |
| -# |
50 |
| -# class StartPage(Frame): |
51 |
| -# def __init__(self, master): |
52 |
| -# Frame.__init__(self, master) |
53 |
| -# Label(self, text="Hi there Welcome to Online Chatting Room", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
54 |
| -# Label(self, text="Only benefit of this is no one knows you are here :):)", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
55 |
| -# Label(self, text="Choose Wisely:---------------", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
56 |
| -# Button(self, text='New User', fg='red', command=lambda: master.switch_frame(NUser), width=50, height=2).pack() |
57 |
| -# Button(self, text='Login', fg='red', command=lambda: master.switch_frame(ULogin), width=50, height=2).pack() |
58 |
| -# Button(self, text='Login Super User', fg='red', command=lambda: master.switch_frame(SULogin), width=50, height=2).pack() |
59 |
| -# Button(self, text='Delete account', fg='red', command=lambda: master.switch_frame(DUser), width=50, height=2).pack() |
60 |
| -# Button(self, text='New Super User', fg='red', command=lambda: master.switch_frame(NSUser), width=50, height=2).pack() |
61 |
| -# Button(self, text='Find Friend By Id', fg='red', command=lambda: master.switch_frame(FFinder), width=50, height=2).pack() |
62 |
| -# class FFinder(Frame): |
63 |
| -# def __init__(self, master): |
64 |
| -# Frame.__init__(self, master) |
65 |
| -# Frame.configure(self, bg='blue') |
66 |
| -# Label(self, text="Find My Friend", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
67 |
| -# Button(self, text="Go back to start page", |
68 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
69 |
| -# class NSUser(Frame): |
70 |
| -# def __init__(self, master): |
71 |
| -# Frame.__init__(self, master) |
72 |
| -# Frame.configure(self, bg='blue') |
73 |
| -# Label(self, text="New Super User", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
74 |
| -# Button(self, text="Go back to start page", |
75 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
76 |
| -# class DUser(Frame): |
77 |
| -# def __init__(self, master): |
78 |
| -# Frame.__init__(self, master) |
79 |
| -# Frame.configure(self, bg='blue') |
80 |
| -# Label(self, text="Delete User", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
81 |
| -# Button(self, text="Go back to start page", |
82 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
83 |
| -# class SULogin(Frame): |
84 |
| -# def __init__(self, master): |
85 |
| -# Frame.__init__(self, master) |
86 |
| -# Frame.configure(self, bg='blue') |
87 |
| -# Label(self, text="Super User Login", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
88 |
| -# Button(self, text="Go back to start page", |
89 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
90 |
| -# |
91 |
| -# class KahesiModeOnn(Frame): |
92 |
| -# def __init__(self, master): |
93 |
| -# Frame.__init__(self, master) |
94 |
| -# Frame.configure(self, bg='blue') |
95 |
| -# Label(self, text="Heya", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
96 |
| -# Button(self, text="Go back to start page", |
97 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
98 |
| -# class ULogin(Frame): |
99 |
| -# def __init__(self, master): |
100 |
| -# Frame.__init__(self, master) |
101 |
| -# # Frame.configure(self, bg='red') |
102 |
| -# userid = StringVar() |
103 |
| -# paswrd = StringVar() |
104 |
| -# def some(): |
105 |
| -# name = userid.get() |
106 |
| -# pass_wrd = paswrd.get() |
107 |
| -# myquery = {"UName": name} |
108 |
| -# mydoc = mycol.find(myquery) |
109 |
| -# for x in mydoc: |
110 |
| -# if x["UPassword"] == pass_wrd: |
111 |
| -# Button(self, text="Login Successful Click To Proceed", width=100, height=2, bd=5, |
112 |
| -# command=lambda: master.switch_frame(KahesiModeOnn)).pack() |
113 |
| -# else: |
114 |
| -# Button(self, text="Login Failed Retry...", width=100, height=2, bd=5, |
115 |
| -# command=lambda: master.switch_frame(ULogin)).pack() |
116 |
| -# userid.set("") |
117 |
| -# paswrd.set("") |
118 |
| -# Label(self, text="UserName", font=('Helvetica', 18, "bold")).pack() |
119 |
| -# Entry(self, bd=5, textvariable=userid).pack() |
120 |
| -# Label(self, text="Password", font=('Helvetica', 18, "bold")).pack() |
121 |
| -# Entry(self, bd=5, textvariable=paswrd).pack() |
122 |
| -# Button(self, text='Login', command=some, width=100, height=2, bd=5).pack() |
123 |
| -# Button(self, text="Go back to start page", width=100, height=2, bd=5, |
124 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
125 |
| -# |
126 |
| -# class NUser(Frame): |
127 |
| -# def __init__(self, master): |
128 |
| -# Frame.__init__(self, master) |
129 |
| -# Frame.configure(self, bg='red') |
130 |
| -# Label(self, text="New User", font=('Helvetica', 18, "bold")).pack(side="top", fill="x", pady=5) |
131 |
| -# Button(self, text="Go back to start page", |
132 |
| -# command=lambda: master.switch_frame(StartPage)).pack() |
133 |
| -# if __name__ == "__main__": |
134 |
| -# app = SampleApp() |
135 |
| -# app.mainloop() |
136 |
| - |
137 |
| - |
138 |
| - |
139 |
| - |
140 |
| - |
141 |
| - |
142 |
| - |
143 |
| - |
144 |
| - |
145 |
| - |
146 |
| - |
147 | 8 |
|
| 9 | +# # ======================================================================================================================= |
148 | 10 |
|
149 | 11 | # setting switch function:
|
150 | 12 | def switch():
|
|
0 commit comments