Apr-27-2020, 09:31 AM
(This post was last modified: Apr-27-2020, 09:31 AM by deanhystad.)
You need to keep the image variable. I think tableau, the image, was destroyed when the local variable tableau no longer exists. I tested the code below and it works for me
class Brittachoix(Frame): def __init__(self, root): super().__init__(root) self.tableau = PhotoImage(file="image.png").zoom(4) Canvasbritta = Canvas(self, width=largeur, height=hauteur, bg="#FFFFFF") TABLEAU = Canvasbritta.create_image(540,340, image=self.tableau) txt = Canvasbritta.create_text(540,570,text="Bonjour", font="Arial 28 italic", fill="red") Canvasbritta.pack() self.pack()