0
def errorswitch():
    global erroron
    if erroron:
        canvas.delete("error_an")
        canvas.delete("text_error_an")
        canvas.update()
        erroron = False
    
    else:
        image_error_an = PhotoImage(file=relative_to_assets("error_1.png"))
        error_an = canvas.create_image(105.0, 100.0, image=image_error_an, anchor="nw", tag="error_an")
        canvas.create_text(5, 110, anchor="nw", text="error", fill="#ff0000", font=("Roboto Bold", 15 * -1), tag = "text_error_an")
        canvas.update()
        erroron = True

The code should show the image, if the function gets executed by another one. The construct itself works perfectly fine, as the text for example is being displayed exactly how it should be. Only the image doesn't. I already checked the image in a different function, and it got displayed without any problem. Also if I paste other images, which are working perfectly fine in other functions, they don't show up.

0 Answers0