How can I close an image shown to the user with the Python Imaging Library?

Viewed 34862

I have several images which I would like to show the user with Python. The user should enter some description and then the next image should be shown.

This is my code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os, glob
from PIL import Image

path = '/home/moose/my/path/'
for infile in glob.glob( os.path.join(path, '*.png') ):
    im = Image.open(infile)
    im.show()
    value = raw_input("Description: ")
    # store and do some other stuff. Now the image-window should get closed

It is working, but the user has to close the image himself. Could I get python to close the image after the description has been entered?

I don't need PIL. If you have another idea with another library / bash-program (with subprocess), it'll be also fine.

3 Answers
Related