From: Massimo Di S. <mas...@gm...> - 2010-11-29 19:48:12
|
Hello All, i'm tring to write python code to display images from a directory .. but i'm not able to learn how to use the matplotlib events to handle how the images will be displaied. simpli i need to pass to the code the path to directory where i have several tiff files and disply them one at time using a key event. to display a single image i'm using somethin like : #!/usr/bin/env python from pylab import * try: import Image except ImportError, exc: raise SystemExit("PIL must be installed to run this example") import glob def dispimg(input): image = Image.open(input) im = imshow(image, origin='lower') show() ########### i tried to define a key action like : def onpress(event): if event.key=='a': fig.canvas.draw() # and set my directory with : fig = figure() fig.canvas.mpl_connect('key_press_event', onpress) TIFFS = glob.glob("/home/habcam/habcamdata/20100820_1840/*.tif") print "num TIFFS %d" % len(TIFFS) ############## but i'm not able to learn how to plot them and update the displayed image using the key bindings : for tif in TIFFS: print tif show() thanks a lot for Any help! Massimo. |