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
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to