-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomePage1.py
77 lines (63 loc) · 2.22 KB
/
homePage1.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
import tkinter as tk
import subprocess
# Define the main window
root = tk.Tk()
root.title("Home Page")
root.geometry("1270x690+0+0")
root.configure(bg="pink")
# # Define the admin login page
# admin_page = tk.Toplevel(root)
# admin_page.title("Admin Login")
# admin_page.geometry("300x200")
# admin_page.configure(bg="lightblue")
# admin_page.withdraw()
#
# # Define the user login page
# user_page = tk.Toplevel(root)
# user_page.title("User Login")
# user_page.geometry("300x200")
# user_page.configure(bg="lightgreen")
# user_page.withdraw()
def button_click(button_type):
if button_type == "admin":
# Code to navigate to the admin login page
run_admin_file()
elif button_type == "user":
# Code to navigate to the user login page
run_user_file()
#function to switch to admin login page
def run_admin_file():
# Run the other Python script
root.withdraw()
subprocess.run(["python", "adminLogin.py"])
#function to switch to user login page
def run_user_file():
# Run the other Python script
root.withdraw()
subprocess.run(["python", "userLogin.py"])
# # Define the function to switch to the admin page
# def admin_login():
# root.withdraw()
# admin_page.deiconify()
#
# # Define the function to switch to the user page
# def user_login():
# root.withdraw()
# user_page.deiconify()
# Define the function to go back to the home page
# def go_home():
# admin_page.withdraw()
# user_page.withdraw()
# root.deiconify()
# Define the buttons in the main window
admin_button = tk.Button(root, text="Admin Login", bg="pink", fg="black", command=lambda: button_click("admin"))
admin_button.pack(pady=20)
user_button = tk.Button(root, text="User Login", bg="pink", fg="black", command=lambda: button_click("user"))
user_button.pack(pady=20)
# Define the back buttons on the login pages
# admin_back_button = tk.Button(admin_page, text="Back", bg="lightblue", fg="black", command=go_home)
# admin_back_button.pack(side="bottom", pady=10)
#
# user_back_button = tk.Button(user_page, text="Back", bg="lightgreen", fg="black", command=go_home)
# user_back_button.pack(side="bottom", pady=10)
root.mainloop()