Is there any way I can force the images to stay? the following is the code that I have adapted from somewhere for this purpose.<br><br>Thanks<br>suresh<br><br>----------------beginning of code--------------------<br>def button_click_exit_mainloop (event):<br>
event.widget.quit() # this will cause mainloop to unblock.<br><br>root = Tkinter.Tk()<br>root.bind("<Button>", button_click_exit_mainloop)<br>root.geometry('+%d+%d' % (100,100))<br>names = ["me1.jpg","me2.jpg","me1.jpg","me2.jpg","me1.jpg","me2.jpg"]<br>
shape = (2,3)<br>xlen,ylen = 0,0<br>for i in range(shape[0]):<br> for j in range(shape[1]):<br> try:<br> images = [Image.open(f) for f in names]<br> images = [x.resize((300,200)) for x in images]<br>
xsize = sum(im.size[0] for im in images)<br> ysize = sum(im.size[1] for im in images)<br> root.geometry('%dx%d' % (xsize,ysize))<br> tkpi = [ImageTk.PhotoImage(im) for im in images]<br>
index = i*shape[1]+j<br> <br> label_image = Tkinter.Label(root, image=tkpi[index])<br> label_image.place(x=xlen,y=ylen,width=images[index].size[0],height=images[index].size[1])<br>
<br> if j == shape[1]-1:<br> ylen = ylen + images[index].size[1] <br> xlen = 0<br> else:<br> xlen = xlen + images[index].size[0] <br> print index,xlen,ylen<br>
root.mainloop() # wait until user clicks the window<br> except Exception, e:<br> # This is used to skip anything not an image.<br> # Image.open will generate an exception if it cannot open a file.<br>
# Warning, this will hide other errors as well.<br> pass <br><br>-------------------------- end of code ------------------<br><br><br><br><br><div class="gmail_quote">On Fri, Jan 8, 2010 at 3:00 PM, Edward Cannon <span dir="ltr"><<a href="mailto:cannon.el@gmail.com">cannon.el@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Manually make a composite image using the paste() function or simillar and then display that one image.<div><div></div><div class="h5"><br>
<br>
<br>
On Jan 8, 2010, at 1:43 PM, Suresh Kumar <<a href="mailto:suresh.amritapuri@gmail.com" target="_blank">suresh.amritapuri@gmail.com</a>> wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
Hi,<br>
<br>
In PIL, how to display multiple images in say m rows and n colums when<br>
I have m*n images.<br>
<br>
suresh<br>
<br>
<br>
-- <br>
R Suresh Kumar,<br>
Phd Student, Vislab<br>
EE, Univ. of California<br>
Riverside, CA 92507<br>
--<br>
Even after all this time The sun never says to the earth, "You owe Me."<br>
Look what happens with A love like that, It lights the Whole Sky.<br>
- Hafiz e Shirazi<br></div></div><div class="im">
_______________________________________________<br>
Image-SIG maillist - <a href="mailto:Image-SIG@python.org" target="_blank">Image-SIG@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/image-sig" target="_blank">http://mail.python.org/mailman/listinfo/image-sig</a><br>
</div></blockquote><div><div></div><div class="h5">
_______________________________________________<br>
Image-SIG maillist - <a href="mailto:Image-SIG@python.org" target="_blank">Image-SIG@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/image-sig" target="_blank">http://mail.python.org/mailman/listinfo/image-sig</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>R Suresh Kumar,<br>Phd Student, Vislab<br>EE, Univ. of California<br>Riverside, CA 92507<br>--<br>Even after all this time The sun never says to the earth, "You owe Me."<br>
Look what happens with A love like that, It lights the Whole Sky.<br>- Hafiz e Shirazi<br><br>