How to get a return from Button?
cosmo_general at yahoo.com
Tue Feb 10 21:21:19 CET 2009
I want to use a Button to trigger askopenfilename() dialog, then I can
select a file. My short code is below:
filenam = askopenfilename(title='Get the file:')
root = Tk()
Button(root, text='Select a file', command=select_file).pack()
My goal is to get the path of filenam, but the function select_file()
has nowhere to return what it selected. Can anybody help me out? I
consulted the book of Programming Python, but found no demo in this
regard. If the function has no return, command=blabla will work
nicely. I am lost in the scope.
More information about the Python-list