copy the tkinter filedialog.py to my code in order to debug

Viewed 31

I want to debug the code in file-explorer-in-python-using-tkinter (link1 code) specially the part that exists in from tkinter import filedialog but the IDEs don't go over to another file while debugging tkinter (maybe this could be solved but right now is not the concern) so I want to copy the code in the C:\ProgramData\Anaconda3\Lib\tkinter\filedialog.py, to the beginning of my code (link1) and comment the line # from tkinter import filedialog in the code of link1 but I get error NameError: name 'filedialog' is not defined and I tried some other things like changing filedialog to FileDialog() in this part of link1 code

def browseFiles():
    filename = filedialog.askopenfilename(initialdir = "/",
                                          title = "Select a File",
                                          filetypes = (("Text files",
                                                        "*.txt*"),
                                                       ("all files",
                                                        "*.*")))

but didn't work also.

So my question is what changes should I do to link1 code in order to run the code in one file, while the beginning is the copy of C:\ProgramData\Anaconda3\Lib\tkinter\filedialog.py and the rest is link1 code?

0 Answers
Related