diff --git a/.gitignore b/.gitignore index cee315cfa872af4cd8fc6738c45225cf74941ecc..5085a4c71728c5a6683f081738f5fa8cd100b83e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ __pycache__ # ignore all files in the static folder except the default folder app/static/* -!app/static/default/ \ No newline at end of file +!app/static/default/ +!app/static/front_end_img/ \ No newline at end of file diff --git a/app/frontend/components/auth/login.py b/app/frontend/components/auth/login.py index 79570d5c1b180f2b907d6120c127ae6ad305b264..38f92282491069b468ec4b4a0a32beb24f3e68da 100644 --- a/app/frontend/components/auth/login.py +++ b/app/frontend/components/auth/login.py @@ -1,10 +1,28 @@ import customtkinter as ctk from tkinter import messagebox +from PIL import Image from utils.api_requests import login_api # Import the login function from login_api.py - def login_frame(parent, switch_func, API_URL): - frame = ctk.CTkFrame(parent) + # Create a container frame to hold both left (empty) and right (login) frames + container = ctk.CTkFrame(parent) + container.grid_columnconfigure(0, weight=1) # Left empty frame + container.grid_columnconfigure(1, weight=1) # Right login frame + container.grid_rowconfigure(0, weight=1) + + # Left empty frame (Just an empty frame to balance the layout) + left_frame = ctk.CTkFrame(container) + left_frame.grid(row=0, column=0, sticky="nsew") + + # Load and display the image + image_path = "app\static\login.jpg" # Change this to your image path + img = ctk.CTkImage(light_image=Image.open(image_path), size=(1000, 1000)) # Resize as needed + image_label = ctk.CTkLabel(left_frame, image=img, text="") # No text, only image + image_label.place(relwidth=1, relheight=1) + + # Right login frame + right_frame = ctk.CTkFrame(container) + right_frame.grid(row=0, column=1, sticky="nsew") def login(): email = entry_email.get() @@ -27,22 +45,22 @@ def login_frame(parent, switch_func, API_URL): "Login Failed", response_data.get("detail", "Invalid credentials") ) - ctk.CTkLabel(frame, text="Login", font=("Helvetica", 18, "bold")).pack(pady=10) + ctk.CTkLabel(right_frame, text="Login", font=("Helvetica", 18, "bold")).pack(pady=10) - ctk.CTkLabel(frame, text="Email:").pack(pady=5) - entry_email = ctk.CTkEntry(frame) + ctk.CTkLabel(right_frame, text="Email:").pack(pady=5) + entry_email = ctk.CTkEntry(right_frame) entry_email.pack(pady=5) - ctk.CTkLabel(frame, text="Password:").pack(pady=5) - entry_password = ctk.CTkEntry(frame, show="*") + ctk.CTkLabel(right_frame, text="Password:").pack(pady=5) + entry_password = ctk.CTkEntry(right_frame, show="*") entry_password.pack(pady=5) - ctk.CTkButton(frame, text="Login", command=login).pack(pady=15) + ctk.CTkButton(right_frame, text="Login", command=login).pack(pady=15) ctk.CTkButton( - frame, + right_frame, text="Don't have an account? Register", command=lambda: switch_func("register"), ).pack() - return frame + return container diff --git a/app/frontend/main.py b/app/frontend/main.py index 7deb9048763090e2efa85309a7c21df2e390da9f..67733940b729ef0edc98fb41e7524bb7e64f0ce8 100644 --- a/app/frontend/main.py +++ b/app/frontend/main.py @@ -49,7 +49,9 @@ frames = { } for frame in frames.values(): - frame.place(relx=0, rely=0, relwidth=1, relheight=1) # Adjusted height for full scaling + frame.place( + relx=0, rely=0, relwidth=1, relheight=1 + ) # Adjusted height for full scaling # Show the login frame first switch_frame("login") diff --git a/app/static/front_end_img/login.jpg b/app/static/front_end_img/login.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b8235c6d4067b453380179dda20c7c72e6da8ab5 Binary files /dev/null and b/app/static/front_end_img/login.jpg differ