0

I have

import tkinter
from tkinter import filedialog

test = filedialog.askopenfilename(initialdir="/", initialfile="file.txt", 
                                  multiple=False, title="Please Select Your File")

But when it pops up, there are two windows and not one. There is "Please select Your File", and an empty window with a symbol and the words "tk". How do I get rid of the second window?

Edit to show my question is different:

But, from here it says that withdraw only hides it. Considering that, how would I make the invisible window close? Would it be

tk.Tk().destroy()

After that?

Community
  • 1
  • 1
13steinj
  • 427
  • 2
  • 9
  • 16
  • @nbro But, from there it says that withdraw only hides it. Considering that, how would I make the invisible window close? Would it be `tk.Tk().destroy()` After that? – 13steinj Jul 25 '15 at 20:24
  • It will be destroyed once the program terminates, but theoretically I think you could call `destroy` or `quit` after closing the dialog... – nbro Jul 25 '15 at 20:24
  • 1
    I've closed this as a duplicate of http://stackoverflow.com/questions/1406145/how-do-i-get-rid-of-python-tkinter-root-window, but I've edited the accepted answer to address how to destroy the root window. – Bryan Oakley Jul 25 '15 at 21:35

0 Answers0