Hi Folks,

I want to use a Button to trigger askopenfilename() dialog, then I can
select a file. My short code is below:


def select_file():
        filenam = askopenfilename(title='Get the file:')
       return filenam

root = Tk()
Button(root, text='Select a file', command=select_file).pack()
root.mainloop()

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.

Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to