import tkinter as tk
root = tk.Tk()
root.title('Student Managment System')
canvas1 = tk.Canvas(root, width = 400, height = 350)
canvas1.pack()
label1 = tk.Label(root, text = "Welcome to the Library", fg = "White", bg = "Black")
canvas1.create_window(200,80, window = label1)
def Login():
lab_ID = tk.Label(root, text = "ID")
canvas1.create_window(90, 200, window = lab_ID)
Password = tk.Label(root, text="Password")
canvas1.create_window(90, 250, window=Password)
ID_entry = tk.Entry(root)
canvas1.create_window(200, 200, window = ID_entry)
Pass_entry = tk.Entry(root)
canvas1.create_window(200, 250, window = Pass_entry)
def Writing_file():
f = open("Data", "w")
id = ID_entry.get()
password = Pass_entry.get()
f.write("{id} {password} \r\n".format(id = id, password = password))
f.close()
Login_Bt = tk.Button(root, text="Login", command = Writing_file)
canvas1.create_window(200, 300, window=Login_Bt)
def Reading_file():
f = open("Data", "r")
line = f.read()
button1 = tk.Button(root, text = "Student", bg = "yellow", fg = "Red", command = Login)
canvas1.create_window(150,150, window = button1)
button2 = tk.Button(root, text = "Admin", bg = "Yellow", fg = "Red", command = Login)
canvas1.create_window(250,150, window = button2)
root.mainloop()