Guest User

Untitled

a guest
Dec 1st, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. class MainScreen(tk.Frame):
  2.  
  3. def __init__(self, parent, controller):
  4. tk.Frame.__init__(self,parent)
  5. label = ttk.Label(self, text="Main Screen", font=LARGE_FONT)
  6. label.pack(pady=10,padx=10)
  7.  
  8. logo = ImageTk.PhotoImage(Image.open('logo.png'))
  9.  
  10. button = ttk.Button(self, text="Teacher",
  11. command=lambda: controller.show_frame(Teacher))
  12. button.pack()
  13.  
  14. button2 = ttk.Button(self, text="Student",
  15. command=lambda: controller.show_frame(Student))
  16. button2.pack()
  17.  
  18.  
  19. class Teacher(tk.Frame):
  20.  
  21. def __init__(self, parent, controller):
  22. tk.Frame.__init__(self, parent)
  23. label = ttk.Label(self, text="Teacher Login", font=LARGE_FONT)
  24. label.pack(pady=10,padx=10)
  25.  
  26. logo = ImageTk.PhotoImage(Image.open('logo.png'))
  27.  
  28. button1 = ttk.Button(self, text="Login",
  29. command=lambda: controller.show_frame(main.login))
  30. button1.pack()
  31.  
  32.  
  33. button1 = ttk.Button(self, text="Home",
  34. command=lambda: controller.show_frame(MainScreen))
  35. button1.pack()
  36.  
  37. #main Class
  38. class main:
  39. def __init__(self,master):
  40. #Login Function
  41. def login(self):
  42. #Establish Connection
  43. with sqlite3.connect('admin.db') as db:
  44. c = db.cursor()
  45.  
  46. #Find user If there is any take proper action
  47. find_user = ('SELECT * FROM user WHERE username = ? and password = ?')
  48. c.execute(find_user,[(self.username.get()),(self.password.get())])
  49. result = c.fetchall()
  50. if result:
  51. self.logf.pack_forget()
  52. self.head['text'] = self.username.get() + 'n Loged In'
  53. self.head['pady'] = 150
  54. else:
  55. ms.showerror('Oops!','Username Not Found.')
Add Comment
Please, Sign In to add comment