[Image-SIG] Needs urgent solution................

Suresh Kumar suresh_vsamy at rediffmail.com
Wed Jun 25 18:15:06 EDT 2003

Hi Alfred,

     Thanks for your timing reply. I tried the program that is
posted in the link given by you. It is working fine. Still i 
a problem. In your program you limited the canvas size to 
Since it is less than a normal screen iam getting the entire 
wihich is drawn on the canvas. But if i increase the size of
canvas to 2 pages, say casvas size is (1600,1500), i am not
getting the entire canvas as a PNG file.

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)


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


         raise NotYetImplemented("oops!")

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

root = Tk()

    The above code is not capturing the canvas of size
    How can i make the entire canvas as PNG file irrespective
of its size?

With Regards,
V.Suresh Kumar

On Wed, 25 Jun 2003 Alfred Milgrom wrote :
>At 01:04 PM 24/06/03 +0000, Suresh  Kumar wrote:
>>    I am using python/tkinter/windows. How to store tkinter
>>canvas screen as a PNG file? I have drawn some rectangles in 
>>canvas and i want to store it as a PNG file so that i can use 
>>for further processing. How can i do it?
>I was asking a similar question just a short while ago, got 
>good advice from Magnus Lycka, and I posted my research on
>specifically grabbing Tkinter canvas on 19/6:
>Basically the answer lies in the ImageGrab module available in
>the PIL library. PIL is available from
>Info on Tkinter grabbing is available at
>All the best,
>Fred Milgrom

Get www. mycompany .com and 5 matching email ids.
Just Rs. 1499/ year.
Click here http://www.rediffmailpro.com

More information about the Image-SIG mailing list