title: How to open jpg and pdf files using tkinter.filedialog.askopenfilename?
body: <p>I found this code online that open a file and show it is tk window. But it only allows me to open the png file. May I know how can I modify the code to open jpg and pdf file, or other file types?</p>
  
  <pre><code>import tkinter
  import tkinter.filedialog
  
  root = tkinter.Tk()
  
  
  def display_image():
      f = tkinter.filedialog.askopenfilename(
          parent=root, initialdir='C:/Tutorial',
          title='Choose file'
      )
  
      new_window = tkinter.Toplevel(root)
  
      image = tkinter.PhotoImage(file=f)
      l1 = tkinter.Label(new_window, image=image)
      l1.image = image
      l1.pack()
  
  
  b1 = tkinter.Button(root, text='Display image', command=display_image)
  b1.pack(fill='x')
  
  root.mainloop()
  </code></pre>