I am trying to put a logo in the upper left-hand corner of my window, but I am getting a completely blank window even though my logo is not the same color as the background. It is giving me no errors, which is making it difficult to troubleshoot.
Code:
from tkinter import *
from PIL import ImageTk, Image
def createTopPage():
img = PhotoImage(file="CMACLOGO.png")
label = Label(app, image=img)
label.pack()
app = Tk()
screenHeight = app.winfo_screenheight()
screenWidth = app.winfo_screenwidth()
app.geometry("{0}x{1}".format(screenWidth,screenHeight))
createTopPage()
app.mainloop()
Thank you for any help/insight!
>Solution :
from tkinter import *
from PIL import ImageTk, Image
def createTopPage():
image = Image.open("CMACLOGO.png")
img = ImageTk.PhotoImage(image)
label = Label(app, image=img)
label.image = img
label.pack()
app = Tk()
screenHeight = app.winfo_screenheight()
screenWidth = app.winfo_screenwidth()
app.geometry("{0}x{1}".format(screenWidth, screenHeight))
createTopPage()
app.mainloop()