title: How to make tkinter slideshow scale images to fit on screen?
body: <p>I am trying to make a image slide show using Tkinter, but I have run into the problem that any image which is not the same as the native resolution of my monitor (or less) will get cut off.</p>
  
  <p>My current code:</p>
  
  <pre><code>import tkinter as tk
  from itertools import cycle
  from PIL import ImageTk, Image
  import random
  
  
  with open('list.txt', 'r') as f: #sparces the list file into something the code can understand
      lines = f.read().strip('[]')
      images = [i.strip("\" ") for i in lines.split(',')]
  
  var1 = input("random?")
  if var1 == "yes" or var1 == "Yes":
      #runs the randomized version of the code
      random.shuffle(images)
  
      photos = cycle(ImageTk.PhotoImage(Image.open(image)) for image in images)
  
      def slideShow():
          img = next(photos)
          displayCanvas.config(image=img)
          root.after(1200, slideShow) 
  
      root = tk.Tk()
      root.overrideredirect(True)
      width = root.winfo_screenwidth()
      height = root.winfo_screenwidth()
      root.geometry('%dx%d' % (1920, 1080))
      displayCanvas = tk.Label(root)
      displayCanvas.pack()
      root.after(1000, lambda: slideShow())
      root.mainloop()
  elif var1 == "no" or var1 == "No":
      #runs the alphabetical version of the code
  
      photos = cycle(ImageTk.PhotoImage(Image.open(image)) for image in images)
  
      def slideShow():
          img = next(photos)
          displayCanvas.config(image=img)
          root.after(1200, slideShow) 
  
      root = tk.Tk()
      root.overrideredirect(True)
      width = root.winfo_screenwidth()
      height = root.winfo_screenwidth()
      root.geometry('%dx%d' % (1920, 1080))
      displayCanvas = tk.Label(root)
      displayCanvas.pack()
      root.after(1000, lambda: slideShow())
      root.mainloop()
  else:
      print("you gotta answer with yes,Yes,no,No,")
      exit
  </code></pre>
  
  <p>how can i make it so that images are scaled to properly show on screen?</p>