#!/usr/bin/env python3
"""
Simple test to verify thumbnail sizes work
"""

import tkinter as tk
from tkinter import ttk
from PIL import Image, ImageTk
import os

# Suppress TensorFlow warnings
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

def test_thumbnails():
    root = tk.Tk()
    root.title("Thumbnail Size Test")
    root.geometry("1000x600")
    
    frame = ttk.Frame(root, padding="20")
    frame.pack(fill=tk.BOTH, expand=True)
    
    # Create test images with different sizes
    sizes = [
        (100, 100, "Small (100x100)"),
        (200, 200, "Medium (200x200)"),
        (300, 300, "Large (300x300)"),
        (400, 400, "HUGE (400x400)")
    ]
    
    for i, (width, height, label) in enumerate(sizes):
        # Create a colored rectangle
        test_image = Image.new('RGB', (width, height), color='red')
        photo = ImageTk.PhotoImage(test_image)
        
        # Create label with image
        img_label = ttk.Label(frame, image=photo)
        img_label.image = photo  # Keep a reference
        img_label.grid(row=0, column=i, padx=10, pady=10)
        
        # Create label with text
        text_label = ttk.Label(frame, text=label, font=("Arial", 12, "bold"))
        text_label.grid(row=1, column=i, padx=10)
    
    # Add instruction
    instruction = ttk.Label(frame, text="This shows the difference in thumbnail sizes. The GUI will use 400x400 and 350x350 pixels!", 
                           font=("Arial", 14, "bold"), foreground="blue")
    instruction.grid(row=2, column=0, columnspan=4, pady=20)
    
    # Add button to test DeepFace GUI
    def open_deepface_gui():
        root.destroy()
        import subprocess
        subprocess.Popen(['python', 'test_deepface_gui.py'])
    
    test_btn = ttk.Button(frame, text="Open DeepFace GUI", command=open_deepface_gui)
    test_btn.grid(row=3, column=0, columnspan=4, pady=20)
    
    root.mainloop()

if __name__ == "__main__":
    test_thumbnails()
