RagZ wrote: > Hello, > > I'm writing an application with a browse button that opens up the > "askdirectory" box to choose a directory. The problem is when the directory > is chosen and the ok button is hit it prints the directory to the terminal > (if it's open) and I would like it to print it to a ENTRY() that I have. For > example: > > from Tkinter import * > from tkFileDialog import askdirectory > > root = Tk() > > e1 = Entry(root) #<---------I would like the dir1 to print > here > > def browser(): > dir1 = askdirectory(parent=root, title="Select A Folder", mustexist=1) > if len(dir1) > 0: > print dir1 > > Button(root, text="Browse", command=browser) > > root.mainloop() > > So from this what I'm asking is how can I get dir1 to print to e1 (the entry > box)? I'm new to Python and am taking the learn-as-I-code route but can't > seem to figure this one out. It might be really easy but I just don't see > it. Thanks for any help. > > > > - RagZ > you should pack or grid button and entry to show it e1 = Entry(root) e1.pack() Button(root, text="FFFF", command=browser).pack()
in browser function you need to insert text to entry def browser(): dir1 = askdirectory(parent=root, title="Select", mustexist=1) if len(dir1) > 0: e1.insert(0, dir1) _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss