I'm trying to create Images in canvas using python class. but when I run the code, Image does not appear. Here is my code :
import tkinter as tk
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from PIL import Image,ImageTk
CompaniesFrame = ttk.LabelFrame(root, text =" Companies ")
CompaniesFrame.place(x=500, y=50)
CompaniesCanvas = ttk.Canvas(CompaniesFrame, width=900, height=500)
CompaniesCanvas.pack()
CompanyPhoto = "Company.png"
class CompanyIconClass:
    def __init__(self,CompanyName,ImagePath):
        self.CompanyName = CompanyName
        self.ImagePath = ImagePath
    def CreatImage(self):
        def OpenCompany(event):
            pass
        CompanyImage = ttk.PhotoImage(file = self.ImagePath)
        CompanyImage = CompanyImage.subsample(4)
        CompanyElement = CompaniesCanvas.create_image(150, 150, image=CompanyImage)
        CompaniesCanvas.tag_bind(CompanyElement, "<Button-1>", OpenCompany)
CompanyIconClass("Img1",CompanyPhoto).CreatImage()
Code works fine when I'm creating Image outside of the python class.
I would be grateful if anyone could help fixing the code.
 
    