grabbing Pictures from the web

Josh Bloom joshbloom at
Wed Apr 11 00:38:36 CEST 2007

I don't have any experience with TK so I can't comment on that but for
getting pics from the web, you will need to do the following:
1) Work with the flickr API or flickr feeds to get the url for each picture
that you want to work with.
2) Either download the image to disk or read it into memory to work with.

Here's some sample code to open a url and save it to disk. (This is
expecting that the url points to a .jpg)

import urllib
picture = urllib.urlopen(pathToTheImageThatYouWant).readlines()
newPic = open('YourNewFile.jpg', 'wb') #Use wb as you're writing a binary


On 4/10/07, Juan Vazquez < juanvazquez at> wrote:
> I am new to python (2 weeks old)  and I would like to write a script that
> grabs pictures from the web (specifically flickr) and put them on a Tk
> Canvas for a slide show/editing program. my 2 questions are
> 1) How do I grab a picture from the web
> 2) is the use of the Tk canvas for working with the picture the best
> approach?
> Any help or references to resources that point me in the right direction
> would be greatly appreciated. Thanks in Advance.
> -Juan
> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list