[Tkinter-discuss] tkinter askdirectory print

RagZ tyragsdale at gmail.com
Wed Feb 13 22:31:17 CET 2008


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
-- 
View this message in context: http://www.nabble.com/tkinter-askdirectory-print-tp15468402p15468402.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list