title: display pdf in sepearate window with python tkinter
body: <p>I have a function checking if a tkinter listbox element is a pdf file. If so, it should be shown via &quot;ShowPdf&quot; in a new window. I only want to view the one pdf I have chosen.</p>
  <p>Using the function once works fine. But if I switch to another listbox element and run the function again, the pdf from the first run and the second run are arranged behind each other. So I see the pdf from the first run at first followed by the second pdf. If I run it a third time, then all three pdfs are arranged behind each other etc.</p>
  <p>Could you please help me so that only the current pdf is shown?</p>
  <pre><code>import tkinter as tk
  from tkPDFViewer import tkPDFViewer as pdf
  
  def OnEntryLeft(event):
      cur_file=listb.get(listb.curselection())
      if (cur_file[-4:]==&quot;.pdf&quot; or cur_file[-4:]==&quot;.PDF&quot;):
          newWindow = tk.Toplevel(root)
          pdf.ShowPdf().pdf_view(newWindow,pdf_location=cur_file,width=75,height=100).pack()
      else:
          messagebox.showinfo(&quot;PDF-Check&quot;, &quot;NO pdf&quot;)
  </code></pre>