Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector as mc
- from tkinter import *
- # MySQL Objects and connection string
- cnx = mc.connect(host="localhost", user="alen", password="alen", database="school")
- cur = cnx.cursor()
- cnx.autocommit = True
- """
- Home function is the default home page. It consists of the login page. It asks the user which group he/she belongs to ie (student, teacher, staff, admin)
- """
- def home():
- window = Tk()
- window.title("SCHOOL MANAGEMENT SYSTEM")
- window.geometry("960x606")
- window.resizable(0,0)
- window.iconbitmap("./ico/school.ico")
- # Creating background image variable
- bg = PhotoImage(file="./img/login.png")
- # Creating the background label
- l1 = Label(window, image=bg)
- l1.place(x=0, y=0)
- # Creating the login text
- l2 = Label(window, text="LOGIN", font=("times new roman", 20, "bold"), bg="#184800", fg="#ff007f")
- l2.place(x=441, y=23)
- # Creating the student button
- l3 = Button(window, text="STUDENT", width=15, font=("times new roman",10, "bold"), command=lambda: stud_lgn_btn(window))
- l3.place(x=435, y=100)
- # Creating the teacher button
- l4 = Button(window, text="TEACHER", width=15, font=("times new roman", 10, "bold"))
- l4.place(x=435, y=140)
- # Creating the staff button
- l5 = Button(window, text="STAFF", width=15, font=("times new roman", 10, "bold"))
- l5.place(x=435, y=180)
- # Creating the admin button
- l6 = Button(window, text="ADMIN", width=15, font=("times new roman",10, "bold"))
- l6.place(x=435, y=220)
- window.mainloop()
- def stud_lgn_btn(window):
- # Killing the previous window and moving to the student window
- window.destroy()
- # Creating new window
- root = Tk()
- root.title("STUDENT LOGIN")
- root.geometry("960x600")
- root.resizable(0,0)
- root.iconbitmap("./ico/student.ico")
- # Creating the background image variable
- bg = PhotoImage(file="./img/student_lgn.png")
- # Creating the label background
- l1 = Label(root, image=bg)
- l1.place(x=0, y=0)
- # Creating student login text
- l2 = Label(root, text="STUDENT LOGIN", background="#413E91", font=("times new roman", 20, "bold"), fg="black")
- l2.place(x=385, y=13)
- # Creating the login username text
- lgnt1 = Label(root, text="USERNAME", font=("times new roman", 10, "bold"))
- lgnt1.place(x=40, y=140)
- # Creating the username login entry form
- user = Entry(root, width=20)
- user.place(x=140, y=140)
- # Creating the login password text
- lgnt2 = Label(root, text="PASSWORD", font=("times new roman", 10, "bold"))
- lgnt2.place(x=40, y=180)
- # Creating the password entry form
- pswd = Entry(root, width=20, show="*")
- pswd.place(x=140, y=180)
- root.mainloop()
- if __name__ == "__main__":
- home()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement