Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter
- from tkinter import *
- from window2 import menu
- import db.db
- from tkinter import messagebox, Button
- from PIL import ImageTk, Image
- #root=login page
- root1=menu
- #rootp=patient form
- #variables
- root=None
- userbox=None
- passbox=None
- topframe=None
- bottomframe=None
- frame3=None
- login=None
- #command for login button
- def GET():
- global userbox,passbox,error
- S1 = userbox.get()
- S2 = passbox.get()
- data = (
- S1,S2
- )
- if S1 == "":
- messagebox.showinfo("Alert!", "Enter USERNAME First")
- elif S2 == "":
- messagebox.showinfo("Alert!", "Enter Password first")
- else:
- res = db.db.user_login(data)
- if res:
- messagebox.showinfo("Message", "Login Successfully")
- root.destroy()
- menu()
- else:
- messagebox.showinfo("Alert!", "Wrong username/password")
- #LOGIN PAGE WINDOW
- def Entry():
- global userbox,passbox,login,topframe,bottomframe,image_1,root
- root = tkinter.Tk()
- # root.geometry("1000x600")
- root.geometry("1920x1080")
- root.iconbitmap('/Users/guneshs/PycharmProjects/HMSnhce/images/hms.ico')
- basewidth = 1080
- baseheight = 1920
- img = Image.open("/Users/guneshs/PycharmProjects/HMSnhce/images/hospital.jpeg")
- # wpercent = (basewidth / float(img.size[0]))
- # hsize = int((float(img.size[1]) * float(wpercent)))
- # hsize = int(hsize * 1.65)
- # basewidth = img.size[1]
- baseheight = int(baseheight * 0.89)
- basewidth = int(basewidth * 0.9258)
- img = img.resize((baseheight, basewidth ), Image.ANTIALIAS)
- background_image = ImageTk.PhotoImage(img)
- l = Label(root, image=background_image)
- l.place(x=0, y=0) #, relwidth=1, relheight=1)
- # topframe = tkinter.Frame(root)
- # topframe.pack()
- # bottomframe=tkinter.Frame(root)
- # bottomframe.pack()
- # l = Label(image=img)
- # l.pack()
- # heading = tkinter.Label(root, text="WELCOME TO Hospital Management System",font='Times 28 bold italic')
- # heading.place(relx=0.0, rely=1.0, anchor='sw')
- username=tkinter.Label(root, text="USERNAME")
- username.place(x=100,y=100)
- userbox = tkinter.Entry(root)
- password=tkinter.Label(root, text="PASSWORD")
- passbox = tkinter.Entry(root, show="*")
- login = tkinter.Button(root, text="LOGIN", command=GET,font="arial 8 bold")
- # heading.pack()
- username.pack()
- userbox.pack()
- password.pack()
- passbox.pack()
- login.pack()
- root.title("DATABASE LOGIN")
- root.mainloop()
- Entry()
Add Comment
Please, Sign In to add comment