Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MainScreen(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self,parent)
- label = ttk.Label(self, text="Main Screen", font=LARGE_FONT)
- label.pack(pady=10,padx=10)
- logo = ImageTk.PhotoImage(Image.open('logo.png'))
- button = ttk.Button(self, text="Teacher",
- command=lambda: controller.show_frame(Teacher))
- button.pack()
- button2 = ttk.Button(self, text="Student",
- command=lambda: controller.show_frame(Student))
- button2.pack()
- class Teacher(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- label = ttk.Label(self, text="Teacher Login", font=LARGE_FONT)
- label.pack(pady=10,padx=10)
- logo = ImageTk.PhotoImage(Image.open('logo.png'))
- button1 = ttk.Button(self, text="Login",
- command=lambda: controller.show_frame(main.login))
- button1.pack()
- button1 = ttk.Button(self, text="Home",
- command=lambda: controller.show_frame(MainScreen))
- button1.pack()
- #main Class
- class main:
- def __init__(self,master):
- #Login Function
- def login(self):
- #Establish Connection
- with sqlite3.connect('admin.db') as db:
- c = db.cursor()
- #Find user If there is any take proper action
- find_user = ('SELECT * FROM user WHERE username = ? and password = ?')
- c.execute(find_user,[(self.username.get()),(self.password.get())])
- result = c.fetchall()
- if result:
- self.logf.pack_forget()
- self.head['text'] = self.username.get() + 'n Loged In'
- self.head['pady'] = 150
- else:
- ms.showerror('Oops!','Username Not Found.')
Add Comment
Please, Sign In to add comment