Skip to content
Snippets Groups Projects
Commit aba7ea1e authored by Nguyen12.Minh@live.uwe.ac.uk's avatar Nguyen12.Minh@live.uwe.ac.uk
Browse files

Modified .gitignore and change frontend components

parent b31e9f3d
No related branches found
No related tags found
1 merge request!6Make change for product and shop also main to show img for frontend and make...
......@@ -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
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
......@@ -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")
......
app/static/front_end_img/login.jpg

68.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment