I'm trying to show a picture in Tkinter using PIL. As suggested in a previous question, I use a label for this:
from Tkinter import *
class App(Frame):
def __init__(self,master):
Frame.__init__(self,master)
self.grid(row=0)
self.columnconfigure(0,weight=1)
self.rowconfigure(0,weight=1)
image = Image.load('example.png')
image = ImageTk.PhotoImage(image.convert('RGBA'))
self.display = Label(self,image=image)
self.display.grid(row=0)
root = Tk()
app = App(root)
app.mainloop()
root.destroy()
Is there a way to resize the image to fit the label? For instance, if example.png is 2000x1000 but the window is only 800x600, only a part of the image is displayed.