kafro 0 Newbie Poster

I'm trying to create a Tkinter that will search through a webiste and import a picture. My codes is a bit messy but I'm able to use the Search button and grab a URL and print the URL in the Python Shell, but I'd like to show the URL image in the Tk window. Any help would be great. Thanks!

from Tkinter import *
import urllib
import Image, ImageTk
import simplejson

window = Tk()
frame = Frame(window)
frame.pack()

label = Label(frame, text="Search")
label.pack()

var = StringVar()
entry = Entry(frame, textvariable=var)
entry.pack()

frame2 = Frame(window)
frame2.pack()

frame3 = Frame(window)
frame3.pack()

def getPhotoInfoDict(topic):
    urlstring = "http://flickr.com/services/rest/?api_key=69ba44a8cc45056ac038f735a2009c65&method=flickr.photos.search&tags="+topic +"&tag_mode=all&has_geo=1&per_page=10&format=json"
    flickrresult = urllib.urlopen(urlstring).read()
    jsonstring = flickrresult[14:len(flickrresult)-1]
    resultdict = simplejson.loads(jsonstring)
    return resultdict

def getPhotoInfo(photodict, i):
    photolist = photodict['photos']['photo']
    if (i < 0) or (i > len(photolist)):
        return null
    else: 
        return photolist[i]

def getImage(photoinfo):
    urlstring = "http://farm" + str(photoinfo['farm']) + ".static.flickr.com/" + str(photoinfo['server']) + "/" + str(photoinfo['id']) + "_" + str(photoinfo['secret']) + ".jpg"
    result = urllib.urlretrieve(urlstring, "flickrpic.jpg")
    return urlstring

def update():
    variable = entry.get()
    print (getImage(getPhotoInfo(getPhotoInfoDict(variable),1)))

    
button = Button(frame3, text="Show me the wallpaper .jpg file", command=update)
button.pack()

window.mainloop()