The error message suggests that the ImageClassifier object does not have an attribute named display_images_buttons. Looking at the code, it seems that the attribute is missing from the __init__ method.

To fix the error, you can add the display_images_buttons attribute to the __init__ method and initialize it as an empty list. Here's the updated code:

import os
import shutil
import tkinter as tk
from tkinter import filedialog
from PIL import Image, ImageTk

class ImageClassifier:
    def __init__(self, root):
        self.root = root
        self.root.title("图片分类工具")
        self.root.geometry("800x600")

        self.image_paths = []
        self.current_index = 0
        self.display_images = []
        self.display_images_buttons = []  # <-- Add this line

        ...

With this modification, the error should be resolved

import osimport tkinter as tkfrom tkinter import filedialogfrom PIL import Image ImageTkclass ImageClassifier def __init__self root selfroot = root selfroottitle图片分类工具 selfroot

原文地址: http://www.cveoy.top/t/topic/iY5e 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录