I´m trying to display a png image on a GUI created with Tkinter. To display the image I'm using Pillow, but something is missing that for now the image is not displayed on the window. Anyone know why it doesn´t work?
Code:
from tkinter import *
from PIL import ImageTk, Image
w = 650
p = 470
x = (w/2) - (w/2)
y = (w/2) - (p/2)
def fourthWindowFunction():
fourthWindow = Tk()
fourthWindow.title("TED")
fourthWindowTitle = Label(fourthWindow, text="Resultados")
fourthWindowTitle.grid(column=1, row=0, padx=10, pady=10)
image = Image.open(r"c:\users\tomas\deformada.png")
display = ImageTk.PhotoImage(image)
generatePDF = Button(fourthWindow, text="Gerar Relatório PDF", command=None)
generatePDF.grid(column=0, row=9, padx=10, pady=10)
exit = Button(fourthWindow, text="Sair", command=quit)
exit.grid(column=2, row=9, padx=10, pady=10)
fourthWindow.geometry('%dx%d+%d+%d' % (w, p, x, y))
fourthWindow.mainloop()
fourthWindowFunction()