How to open PIL Image in Tkinter on Canvas

后端 未结 4 1136
面向向阳花
面向向阳花 2021-02-14 18:08

I can\'t seem to get my PIL Image to work on canvas. Code:

from Tkinter import*
import Image, ImageTk
root = Tk()
root.geometry(\'1000x1000\')
canvas = Canvas(ro         


        
4条回答
  •  情深已故
    2021-02-14 18:42

    I was banging my head against the wall for a while on this issue until I found the following:

    http://effbot.org/pyfaq/why-do-my-tkinter-images-not-appear.htm

    Apparently, Python's garbage collector can trash the ImageTk object. I imagine apps using alot of widgets (like mine) are more susceptible to this behavior.

提交回复
热议问题