import os import tkinter as tk from tkinter import messagebox from tkinter import simpledialog # Get user input for minimum file size root = tk.Tk() root.withdraw() minimum_size = tk.simpledialog.askinteger("Minimum Image File Size", "Enter the minimum file size (in bytes) to include in results:") # Define the path to the image directory image_path = "C:/3308/MyImages/" # Create a list of image files that meet the size requirement image_list = [] for filename in os.listdir(image_path): if filename.endswith(".jpg") or filename.endswith(".png"): filepath = os.path.join(image_path, filename) if os.path.getsize(filepath) >= minimum_size: image_list.append((filename, os.path.getsize(filepath))) # Create the popup box with the list of image files if not image_list: messagebox.showinfo("No images found", f"No images found larger than {minimum_size} bytes.") else: message = "" for filename, size in image_list: message += f"{filename} - {size} bytes\n" messagebox.showinfo("Image List", message)