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

后端 未结 3 1183
闹比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条回答
  •  一整个雨季
    2021-01-13 15:47

    when you place the image variable in the label , you must initiate the image variable to "image".

    Eg: (CORRECT APPROACH)

    photo = PhotoImage(file = "C://Users//Carl//Downloads//download.png")
    label1 = Label(image = photo)
    label1.pack()
    

    Eg : (WRONG APPROACH)

    photo = PhotoImage(file = "C://Users//Carl//Downloads//download.png")
    label1 = Label(photo)
    label1.pack()
    

提交回复
热议问题