title: Python - keeping Tkinter window open?
body: <p>Right now I am using Tkinter to prompt the user for a file.</p>
  
  <pre><code>Tk().withdraw() # keep the root window from appearing
  file_path = askopenfilename() # show dialog box and return file path
  
  # check if extension is valid
  </code></pre>
  
  <p>If the user selected the wrong file type, I re-prompt them with a new window.</p>
  
  <p>Is there a way, instead, to keep the same tkinter window open unless the file selected is valid?  </p>
  
  <p>so instead of this:</p>
  
  <pre><code># 1) prompt user to open file
  # 2) close file browser window
  # 3) check if extension is valid
  # 4) if not, print error and re-prompt user with new browser window
  </code></pre>
  
  <p>I want to do this:</p>
  
  <pre><code># 1) prompt user to open file
  # 2) check if extension is valid while keeping window open
  # 3) if not, print error, re-prompting with same window
  </code></pre>
  
  <p>Any help is appreciated.</p>