Hi,

      Iam using python2.2/tkinter/windows. I have drawn some 
rectangles in my canvas. Now I want to store my canvas as a PNG 
file. Iam using "ImageGrab"  to grab the canvas. Iam getting the 
result as i expected when the canvas size is less than 
"canvas.winfo_width" and "canvas.winfo_height". But when the size 
larger than that, iam not getting the entire canvas image.
     My coding is given below.

import sys
 from Tkinter import *
import Tkinter
import ImageGrab

canvas = Tkinter.Canvas(width=1600, height=1400)
canvas.create_line(0, 0, 1600, 1400, fill="red", width=10)
canvas.pack()

canvas.update()

if sys.platform == "win32":
         # get window location
         x0 = canvas.winfo_rootx()
         y0 = canvas.winfo_rooty()
         x1 = x0 + canvas.winfo_reqwidth()
         y1 = y0 + canvas.winfo_reqheight()

         im = ImageGrab.grab((20,20, x1,y1))
         print "X1 : ",x1," Y1: ",y1


else:

         raise NotYetImplemented("oops!")

im.show()
im.save("c:\\outfile.png", "PNG")

root = Tk()
root.mainloop()

    How can i make the the entire canvas as PNG file irrespective 
of its size?

With Regards,
V.Suresh Kumar
___________________________________________________
Get www. mycompany .com and 5 matching email ids.
Just Rs. 1499/ year.
Click here http://www.rediffmailpro.com




