Trying to display a BMP image

Thomas & Jennifer Thompson tmt1630 at
Sat Mar 25 04:10:11 CET 2000

Hi Willie,

I spent today (virtually all of it) trying to get this to work....and
it was because I have a need to do the same thing as you.  I only
found your note out of frustration this evening because I
couldn't get it to work!!  Misery loves company, right?!

Anyways, I poked at it some more and I got this piece of code to
work....maybe it'll help you....

from Tkinter import *
import Image, ImageTk, os

class Display_Image:
    def __init__(self, master=None):
        self.master = master
        self.frame = Frame(master, width=400, height=400, bg="White")
        self.lbl = Label(self.frame, bg='White', fg='Black')

        self.lbl['image'] = self.img

root = Tk()
display_image = Display_Image(root)

Willie Peloquin wrote:

> Hi,
> I am trying to load a BMP image and display it in a label. I am pretty
> new to using PIL, and I have not used Python in quite a while. I will
> appreciate any hints!
> When I try to run the script (Windows NT). I get the
> following error....
> TclError: invalid command name "PyImagingPhoto"
> I made certain that the _imaging.dll is in the Python DLL directory.
> I am using the following bit of code, and I am having no luck....
> img ='im000001.bmp')
> img.load()      #tried with and without load
> print 'mode = ', img.mode
> print 'size = ', img.size
> pi = BitmapImage(img) #or PhotoImage(img)
> Label(liveRawF, image=pi).pack(side=TOP, expand=YES, fill=BOTH)
> Thanks,
> Willie
> Willie Peloquin
> esi - Vision Products Division
> 734.332.7180 phone
> 734.332.7077 fax
> Sent via
> Before you buy.

More information about the Python-list mailing list