You have to work out the code yourself. But what I'll do is provide you a way how to format your code & how to implement the problem you are having.
import tkFileDialog
from Tkinter import Tk,Button,StringVar,Entry
class MainClass():
def __init__(self,master):
self.parent=master
self.mainfunc()
def mainfunc(self):
self.path_setup = StringVar()
browse=Button(root,text="Browse",command=lambda:self.path_setup.set(tkFileDialog.askopenfilename(filetypes=[("Image File",'.jpg')])))
browse.grid(row=1,column=1,sticky='E')
path_entry = Entry(root, textvariable=self.path_setup,state='disabled')
path_entry.grid(row=1,column=0,sticky='E')
if __name__ == '__main__':
root = Tk()
root.title("My Program")
root.wm_resizable(0,0)
client = MainClass(root)
root.mainloop()
It's a "piece" of code which I was working on. I have formatted it for you.
Hope this gets you going :)