Advertisement
xxmakarovxx

logInSystemPython

Aug 28th, 2023
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | Source Code | 0 0
  1. from tkinter import *
  2. #from PIL import ImageTk
  3. from tkinter import messagebox
  4.  
  5. class Login:
  6. def __init__(self, root):
  7. self.root = root
  8. self.root.title("AVA Log In System")
  9. self.root.geometry("500x500+100+50")
  10. self.root.resizable(False, False)
  11.  
  12. #self.bg = ImageTk.PhotoImage(file="image/AVA.jpg")
  13. #self.bg_image = Label(self.root, image=self.bg).place(x=0, y=0, relwidth=1, relheight=1)
  14.  
  15. Frame_login = Frame(self.root, bg="white")
  16. Frame_login.place(x=125, y=100, width=250, height=245)
  17.  
  18. title = Label(Frame_login, text="Please Log In", font=("Times New Roman", 20, "bold"), fg="gold", bg="white").place(x=43, y=8)
  19. subtitle = Label(Frame_login, text="Members Login Area", font=("Cambria", 10, "bold"), fg="black", bg="white").place(x=60, y=50)
  20.  
  21. lbl_user = Label(Frame_login, text="Username", font=("Cambria", 10, "bold"), fg="gray", bg="white").place(x=90, y=80)
  22. self.username = Entry(Frame_login, font=("Cambria", 10), bg="#E7E6E6")
  23. self.username.place(x=60, y=100, width=130, height=20)
  24.  
  25. lbl_password = Label(Frame_login, text="Password", font=("Cambria", 10, "bold"), fg="gray", bg="white").place(x=92, y=120)
  26. self.password = Entry(Frame_login, font=("Cambria", 10), bg="#E7E6E6")
  27. self.password.place(x=60, y=140, width=130, height=20)
  28.  
  29. login = Button(Frame_login, command=self.check_function, cursor="hand2", text="Log In", bd=0, font=("Cambria", 10), fg="black", bg="gold").place(x=102, y=175)
  30. forget = Button(Frame_login, text="Forgot Password", bd=0, cursor="hand2", font=("Cambria", 10), fg="gray", bg="white").place(x=75, y=207)
  31.  
  32. def check_function(self):
  33. if self.username.get() == "" or self.password.get() == "":
  34. messagebox.showerror("Error", "Please complete your details", parent=self.root)
  35. elif self.username.get() != "Nina" or self.password.get() != "1234567":
  36. messagebox.showerror("Error", "Invalid Username or Password", parent=self.root)
  37. else:
  38. messagebox.showinfo("Welcome to AVA Property and Marketing Services", f"Welcome {self.username.get()}")
  39.  
  40. root = Tk()
  41. obj = Login(root)
  42. root.mainloop()
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement