[Tutor] Tutor Digest, Vol 20, Issue 37

Michael Lange klappnase at freenet.de
Tue Oct 11 11:17:39 CEST 2005

On Mon, 10 Oct 2005 17:07:47 -0600
Joseph Quigley <cpu.crazy at gmail.com> wrote:

> Hi,
> Unfortunately I get this error:
> Exception in Tkinter callback
> Traceback (most recent call last):
> File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__
> return self.func(*args)
> File "Programming/Gacor/tmp.py", line 83, in newPic
> imgPrep.configure(file=os.path.join(imgDir, pics[pic]))
> AttributeError: PhotoImage instance has no attribute 'configure'
> I think I should mention that I'm completely in the dark when it comes 
> to GUI programming (and I don't have much time to learn it... or do I?)

Oops, sorry for that; in fact it looks like you will have to define a new PhotoImage instance, like:

def newPic():
    global pic, imgPrep
    pic = pic + 1
    imgPrep = ImageTk.PhotoImage(file=file=os.path.join(imgDir, pics[pic]))

The configure() method works for Tkinter.PhotoImage, but obviously not for ImageTk.PhotoImage, so I got trapped here.



More information about the Tutor mailing list