-1

Trying to create a window and add a frame with an image into it

import tkinter as tk
from tkinter import ttk
from PIL import Image, ImageTk

class Window(tk.Tk):
    def __init__(self,windowTitle,size):
        super().__init__()
        self.title(windowTitle)
        self.geometry(f"{size[0]}x{size[1]}")
        self.resizable(width=False, height=True)
        #ui attributes

        self.frame1 = RadioB(self, 1, "hi", 0, 0)



        self.mainloop()

class RadioB(tk.LabelFrame):
    def __init__(self, parent, directory, foodName, rowNum, colNum):
        super().__init__(parent)

        self.config(text=foodName)
        imageLoad = Image.open(r'D:\Screenshot-2023-07-12-231818.png')
        imageLoad = imageLoad.resize((190,300))
        image1 = ImageTk.PhotoImage(imageLoad)

        tk.Label(self, image = image1).pack()
        self.grid(row = rowNum, column = colNum)


onlyWindow = Window("Login / Sign Up", (760,870))

The layout is fine, just that the images are invisible but takes up space

  • [Why do my Tkinter images not appear?](https://web.archive.org/web/20201111190625id_/http://effbot.org/pyfaq/why-do-my-tkinter-images-not-appear.htm) – Nesi Aug 10 '23 at 14:10

0 Answers0