0

So just started doing some tkinter programming and I'm trying to output an image into a frame. So this is the code I've got so far bearing in mind this is the third frame of my entire window but I've not included the code for the first two since it's not particularly relevant.

import tkinter #importing tkinter
from tkinter import ttk
from tkinter import messagebox
from PIL import ImageTk, Image

MainMenuWin=tkinter.Tk()
MainMenuWin.title("Main Menu")

frame=tkinter.Frame(MainMenuWin, bg="#0073CF")
frame.pack()

image_frame=tkinter.Frame(frame, bg='#0073CF')
image_frame.grid(row=2,column=0)

img=ImageTk.PhotoImage(Image.open("nhslogo.jpg"))
image_label=tkinter.Label(image_frame, image=img)

MainMenuWin.mainloop()

So this is meant output an image and I've definitely saved the file into the same folder as the code and it's definitely the right file name. Any ideas?

LewOF04
  • 1
  • 2
  • The directory your code is in is completely irrelevant. What is relevant is the current working directory. – Sören Nov 20 '22 at 14:07

0 Answers0