I'm trying to set up some Python scripts to do some file manipulation and I was trying tkinter after some googling of libraries to use.
The following only half works:
from tkinter import filedialog
file_path = filedialog.askopenfilename()
print(file_path)
export_folder = filedialog.askdirectory()
print(export_folder)
When I run this code in VSCode, the askopenfilename() works properly, but when it moves on to the askdirectory() it just seems to hang and I end up having to kill the script after some time.
However, when I run the exact same code using IDLE, it does both things just fine.
Has anyone else had this issue with VSCode and if so, how did you fix it?
IDLEandVSCodeare tools only to create code. You don't need it to run it when all code is finished, and other people also don't needIDLEandVSCodeto use your script - so more important is how it works withoutIDLEandVSCodeaskopenfilename().