[Tutor] saving Tkinter canvas as jpg

Joel Goldstick joel.goldstick at gmail.com
Mon Dec 9 02:34:59 CET 2013


On Sun, Dec 8, 2013 at 8:10 PM, Benjamin Fishbein <bfishbein79 at gmail.com>wrote:

> Have you imported PIL ?  Show a small coding example here with the
> traceback. Cut and paste the traceback, don't paraphrase it.
>
>
> Here's what printed out:
>
> Traceback (most recent call last):
>   File "<pyshell#65>", line 1, in <module>
>     from PIL import ImageGrab
>   File "/Library/Python/2.7/site-packages/PIL/ImageGrab.py", line 34, in
> <module>
>     import _grabscreen
> ImportError: No module named _grabscreen
>

What happens if you import PIL like this:

import PIL

You will then need to use PIL.ImageGrab in your code

>
> From what I've seen online, this isn't available for mac...of course
> everything about this module is several years old, and it hasn't been
> updated with a new version in a few years, so I think there must be
> something better than it.
>
>
> I'm writing a program to draw pictures. I'm using Python 2.7.3 on Mac OSx.
>> I'm trying to find a good way to save the canvas as a jpg (or other pic
>> formats). The advice I've found on stackoverflow is ImageGrab from PIL, but
>> apparently that doesn't work for macs. I get the "no module named
>> _grabscreen" ImportError.
>> Can you recommend a good module for saving the canvas into a picture file?
>> Thank you,
>> Ben
>>
>
> --
> Joel Goldstick
> http://joelgoldstick.com
>
>
>


-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131208/b7a8ca55/attachment.html>


More information about the Tutor mailing list