-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
67 lines (53 loc) · 1.83 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# all modules needed to import
from tkinter import *
from subprocess import call
from datetime import datetime
from datetime import date
#for display of current date and time
today=date.today()
d1=today.strftime("%d/%m/%Y")
now=datetime.now()
current_time=now.strftime("%H:%M:%S")
#to check the password and username
def command1(event):
if entry1.get()=='harsh' and entry2.get()=='123456':
root.destroy()
call(["python","Hotel_management_system.py"])
else:
label=Label(root,text="Wrong Password or Username",fg="red",font="times 15")
label.pack()
label2=Label(root,text=" Please retry again.",fg="red",font="times 15")
label2.pack()
#defining root base of tkinter program
root = Tk()
root.iconbitmap('hotel.ico')
root.geometry('500x520')
root.title('LOGIN SCREEN')
hotel_image=PhotoImage(file='HOTEL.gif')
photo=Label(root,image=hotel_image,bg='white')
photo.pack()
#main screen
mylabelmain=Label(root,text="LOGIN YOUR ACCOUNT",font="Courier 20 bold")
mylabelmain.pack()
#entering username
mylabel=Label(root,text="Username:",font="Courier 15")
mylabel.pack()
entry1=Entry(root,width=25)
entry1.pack()
#entering password
label2=Label(root,text="Password:",font="Courier 15")
label2.pack()
entry2=Entry(root,show='*',width=25)
entry2.pack()
#blind buttontype entry for enter on keyboard
entry2.bind('<Return>',command1)
#exit the program
button1=Button(root,text='Cancel',font="Courier 12",command=root.destroy)
button1.pack()
#display of date and time in tkinter
date= Label(root, text=d1, fg="white", bg="black", font="times 13")
date.place(x=390,y=450)
time=Label(root,text=current_time,fg="white", bg="black",font="times 13")
time.place(x=390,y=420)
#infinitly looping the GUI to work
root.mainloop()