AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'

后端 未结 3 1207
闹比i
闹比i 2021-01-13 15:12

I am working on Yolo3-4-PY to implement it with tkinter.

I\'ve looked up everywhere but not able to resolve the issue.

When I run the program the canvas is d

3条回答
  •  萌比男神i
    2021-01-13 15:50

    in my case , correct with just simply add this line

    root = tkinter.Tk()
    

    complete code :

    root = tkinter.Tk()
    image = PIL.Image.open(r"C:\Users\Hamid\Desktop\asdasd\2.jpeg")
    img = ImageTk.PhotoImage(image)
    l = Label(image=img)
    l.pack()
    

提交回复
热议问题