-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.py
97 lines (80 loc) · 3.42 KB
/
ui.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import tkinter as tk
from oldUser import *
from forgotPassword1 import *
from createAccount import *
from globalDict import *
class ui:
def __init__(self, windows):
# creat the window
self.windows = windows
#window = tk.Tk()
try:
conn = sqlite3.connect('C:\\Users\\HimelSaha\\Documents\\PyCharm Projects\\Hospital app\\record.db')
print(conn)
print("::Database connected successfully::")
except Error as e:
print(e)
print("::Failed to connect to the database::")
sys.exit(1)
try:
conn.execute('CREATE table record(id INTEGER PRIMARY KEY AUTOINCREMENT, first TEXT, middle TEXT, last TEXT, '
'bday DATE, number NUMERIC, question TEXT, ans TEXT, email TEXT, pass TEXT)')
print("::Table created successfully::", end="\n\n")
except:
print("::Table already exists::", end="\n\n")
#creat a lable, won't show up to the window until the nexet line
greeting = tk.Label(master = windows,text="\nWelcome to the App!\n")
greeting.configure(font=("Lucida Console", 20, "bold"))
#height and with are measured in text unit
g2 = tk.Label(master = windows,text = "Log-in\n")
g2.configure(font=("Lucida Console", 20,"bold"))
# add the label to the window
greeting.pack()
g2.pack()
email = tk.Label(master = windows,text="E-Mail")
email.configure(font=("Lucida Console", 15))
email_entry = tk.Entry(master = windows)
email_entry.insert(0, "[email protected]")
email.pack()
email_entry.pack()
# password
pw = tk.Label(master = windows,text="\npassword")
pw.configure(font=("Lucida Console", 15))
password = tk.Entry(show="*")
pw.pack()
password.pack()
def loginNext():
email_input = email_entry.get() # will go to database
password_input = password.get()
oldUser(email_input, password_input, windows)
# for the medical condition
#mc = tk.Text()
#mc.pack()
space = tk.Label(master = windows,text="\n")
space.pack()
send_b = tk.Button(master=windows,text = "Log in", bg="purple", fg="black", command=loginNext)
send_b.pack()
space = tk.Label(master = windows,text="\n")
space.pack()
def forgot():
windows.withdraw() # to close the window!!
toplevel = tk.Toplevel(self.windows) # close the first window
toplevel.geometry("853x480")
forgotPassword1(toplevel)
forget = tk.Button(master=windows, text = "Forgot Password?", command=forgot)
forget.pack()
def create():
windows.withdraw() # to close the window!!
toplevel = tk.Toplevel(self.windows) # close the first window
toplevel.geometry("853x480")
createAccount(toplevel)
#sign-up option
space = tk.Label(text="\ndon't have an account yet?")
space.pack()
send_b = tk.Button(master=windows,text = "sign up", command=create)
send_b.pack()
space = tk.Label(master = windows,text="\n")
space.pack()
## windows = tk.Tk()
## windows.geometry("853x480")
## windows.mainloop()