用python写一个,可以实现你的要求
[Python] 纯文本查看 复制代码 from PIL import Image, ImageTk
import os
import tkinter as tk
def show_next_image():
global current_image_index
if current_image_index < len(image_files) - 1:
current_image_index += 1
else:
current_image_index = 0
show_image()
def on_double_click(event):
show_next_image()
def show_image():
img_path = os.path.join(image_folder, image_files[current_image_index])
img = Image.open(img_path)
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
img_ratio = img.width / img.height
screen_ratio = screen_width / screen_height
if img_ratio > screen_ratio:
new_width = screen_width
new_height = int(screen_width / img_ratio)
else:
new_height = screen_height
new_width = int(screen_height * img_ratio)
resized_img = img.resize((new_width, new_height), Image.LANCZOS)
tk_img = ImageTk.PhotoImage(resized_img)
label.config(image=tk_img)
label.image = tk_img
image_folder = "C:\\Users\\TPM\\Pictures\\Saved Pictures\\"
image_files = [f for f in os.listdir(image_folder) if f.endswith(('.jpg', '.png', '.jpeg'))]
current_image_index = 0
root = tk.Tk()
root.attributes('-fullscreen', True)
root.overrideredirect(True)
label = tk.Label(root)
label.pack(fill=tk.BOTH, expand=True)
show_image()
root.bind("<Double-Button-1>", on_double_click)
root.mainloop() |