[Tkinter-discuss] ImageTk.PhotoImage: empty image not holding its size

Dan Halbert halbert at halwitz.org
Thu Sep 17 18:31:12 CEST 2009


Hi, I have a picky question about using an empty ImageTk.PhotoImage. I am trying to create a placeholder space for an image that will be supplied later - something like this:

    root = Tk()
    pimage = ImageTk.PhotoImage('RGB', (300,300))
    image_holder = Label(root, image=pimage)
    image_holder.grid()

However, the result is a a tiny window, not one with a 300x300 empty space. If I do pimage.paste(...) later with a real image, it grows as expected to fit the image.

I could set the width and height of the Label to 300x300 when I create it, but shouldn't the empty PhotoImage act like a 300x300 image?

Thanks,
Dan
 



More information about the Tkinter-discuss mailing list