[Tutor] New image with Tkinter?
Joseph Quigley
cpu.crazy at gmail.com
Mon Oct 10 19:36:22 CEST 2005
Hi,
I've written an image reader that uses the PIL module.
I have a variable that uses os.listdir('mydir') to make a list of all the
pictures in the folder... here's what I'm talking about:
pics = os.listdir(imgDir)
pics.remove('license.txt')
pics.remove('gacor.py')
class Data:
pic = 0
print "There are %s saved images in the image folder." % len(pics)
def newPic():
Data.pic += 1
def quitProg():
raise SystemExit
def Dsp_Image():
root = Tk()
root.title("GaCoR Image Browser")
app = Frame(root)
app.grid()
img = Image.open('%s%s' % (imgDir, pics[Data.pic]))
imgPrep = ImageTk.PhotoImage(img)
imgShow = Label(app, image=imgPrep).grid()
info = Label(app, text="Displaying %s" % pics[Data.pic]).grid()
next = Button(app, text="Next Image", command=newPic).grid()
close = Button(app, text="Close", command=quitProg).grid()
print Data.pic
app.mainloop()
Dsp_Image()
The image won't refresh when I click on 'Next'! Any help would be
appreciated.
Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051010/d7ce931e/attachment.htm
More information about the Tutor
mailing list