display an image from a URL using Tkinter
tested with Python27 and Python33 by vegaseat 13feb2013
import urllib2 as url_lib
import Tkinter as tk
import urllib.request as url_lib
import tkinter as tk
root = tk.Tk()
# find yourself a picture on an internet web page you like
# (right click on the picture, under properties copy the address)
#url = "http://www.google.com/intl/en/images/logo.gif"
# or you can upload one of your own images to tinypic.com
url = "http://i48.tinypic.com/9aod3n.gif"
picture = url_lib.urlopen(url).read()
# save the image as a file
fname = 'xyz_' + url.split('/')[-1]
with open(fname, "wb") as fout:
# read image file back in
img = tk.PhotoImage(file=fname)
# put the image on a typical widget
label = tk.Label(root, image=img)
You're trying to visit a URL that doesn't currently exist on the web.
Most likely, a member posted a link a long time ago to a web page that has since been removed.
It's also possible that there was a typo when posting the URL.
We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.