Are you trying to do something like this?
import tkinter as tk from tkinter import ttk class Container(tk.Canvas): ''' Container creates an image on a canvas ''' def __init__(self, parent, img, x, y, *args, side='left', **kwargs): super().__init__() # Create the canvas self.canvas = tk.Canvas(parent, width=100, height=100) self.canvas.pack(side=side, fill='x') # Create the image bg = tk.PhotoImage(file=img) bg.bak = bg self.canvas.create_image(x, y, image=bg) class Window: def __init__(self, parent): # Create the notebook notebook = ttk.Notebook(parent) notebook.pack(expand=True, fill='both') # Create three frames frame1 = ttk.Frame(notebook, width=400, height=400) frame1.pack() frame2 = ttk.Frame(notebook, width=400, height=400) frame2.pack() frame3 = ttk.Frame(notebook, width=400, height=400) frame3.pack() # Create the image instances using the Container class img1 = Container(frame1, 'On Off/green.png', 50, 50, side='top') img2 = Container(frame2, 'On Off/red.png', 50, 50, side='top') img4 = Container(frame3, 'On Off/green.png', 50, 50, side='top') img5 = Container(frame3, 'On Off/red.png', 50, 50, side='top') # Add tabs to notebook notebook.add(frame1, text='Frame 1') notebook.add(frame2, text='Frame 2') notebook.add(frame3, text='Frame 3') if __name__ == '__main__': root = tk.Tk() root.geometry('1600x1000+400+200') Window(root) root.mainloop()I would probably use labels for the image unless, there was a need for the canvas.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags