jpeg files displayed in a loop

Kevin Cazabon kevin at cazabon.com
Tue Dec 11 15:03:19 EST 2001


import Tkinter
import Image, ImageTk
import os

dir="c:\\temp\\"


def showimage():
    image = pop(files)
    files.append(image)
    image = ImageTk.photoimage(Image.open(image)) #ok, do try/except
    b.configure(image=image)
    b.update_idletasks()
    b.after(1000, showimage)

a = Tkinter.tk()
b = Tkinter.label(a)
b.pack()

files = os.listdir(dir) # ok, check them for file types...
while 1:
    showimage()



# ok, probably a couple minor typos, but it should be that simple.

Kevin Cazabon.
kevin at cazabon.com


Wolfgang Teschner <wtr at hannover.sgh-net.de> wrote in message news:<rp8a1u82me3g8v8ievtfjve9llbodq6rau at 4ax.com>...
> Hi,
> I want to automatically display all jpeg files of a dir in a long
> loop, with a wait time between the different displays. Just that.
> No user input.
> With PIL, it seems to be impossible because of TKinters mainloop.
> 
> Are there other ways/packages for this purpose? Just displaying the
> images as they are...
> platform is win32, but I would be interested for independant
> solutions, if they exist.
> 
> Thanks,
> wolfgang teschner



More information about the Python-list mailing list