I would like to create a GUI that receives two paths (a directory full of .txt documents and the destination of a new .csv file created from the files of the previously mentioned folder).
I am having trouble calling the function munge():
action = tk.Button(win, text="To .csv",command=munge(input_directory,output_directory))
Nevertheless, this exception raised:
/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/user/PycharmProjects/script.py
Traceback (most recent call last):
File "/Users/user/PycharmProjects/script.py", line 82, in <module>
action = tk.Button(win, text="To .csv", command=munge(input_directory,output_directory))
File "/Users/user/PycharmProjects/script.py", line 39, in munge
test = tuple(retrive(directory))
File "/Users/user/PycharmProjects/script.py", line 31, in retrive
for filename in sorted(glob.glob(os.path.join(directory_path, '*.txt'))):
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 70, in join
elif path == '' or path.endswith('/'):
AttributeError: StringVar instance has no attribute 'endswith'
Process finished with exit code 1
How can I correctly call the aforementioned function with the help of the Button widget?. I tried to set the name of the variable as indicated here question, but it did not worked.
update
Then from an answer of this question, I tried the following:
action = tk.Button(win, text="To .csv", command=lambda:munge(input_directory,output_directory))
