#!/usr/bin/env python3 """ Test script to verify image display functionality """ import tkinter as tk from PIL import Image, ImageTk import os def test_image_display(): # Create a simple tkinter window root = tk.Tk() root.title("Image Display Test") root.geometry("800x600") root.configure(bg='black') # Create image label image_label = tk.Label(root, bg='black') image_label.pack(fill=tk.BOTH, expand=True) # Test image path test_image = "/home/pi/Desktop/signage-player/tkinter_app/src/static/resurse/1307306470-nature_wallpaper_hd_hd_nature_3-3828209637.jpg" try: if os.path.exists(test_image): print(f"Loading image: {test_image}") # Load and display image img = Image.open(test_image) img.thumbnail((800, 600), Image.LANCZOS) photo = ImageTk.PhotoImage(img) image_label.config(image=photo) image_label.image = photo # Keep reference print(f"Image loaded successfully: {img.size}") # Close after 3 seconds root.after(3000, root.quit) else: print(f"Image file not found: {test_image}") image_label.config(text="Image file not found", fg='white') root.after(2000, root.quit) except Exception as e: print(f"Error loading image: {e}") image_label.config(text=f"Error: {e}", fg='red') root.after(2000, root.quit) root.mainloop() print("Image display test completed") if __name__ == "__main__": test_image_display()