Here is my code
def new_grille():
global cc
global tab
global tableau
x = cc[0]
y = cc[1]
fenetre = tk.Tk()
fenetre.title('Gomoku : Coup joueur Blanc')
fenetre.attributes('-fullscreen', True)
fenetre.bind('<Escape>', lambda e: fenetre.destroy())
fenetre.config(bg='#FFFFFF')
tableau = tk.Canvas(fenetre, width = 1700, height = 1500, bg ="#FFFFFF")
tableau.pack(side = tk.BOTTOM, pady=100)
img = Image.open('boutton quitter.png')
img_quitter = ImageTk.PhotoImage(img)
boutton_quitter = tk.Button(fenetre, width=45, height=7,image = img_quitter, command=lambda x="": on_closing())
boutton_quitter.image = img_quitter
boutton_quitter.place(x=1500, y=100)
boutton_quitter.pack()
Im trying to display on the 'boutton_quitter' button an image ('boutton_quitter.png) but it raise an error (_tkinter.TclError: image "pyimage13" doesn't exist), ive tried lot of things but nothing worked, pls help me :)
I saw different things, toplevel methods and trying to stock the image in a global function but either i messed up, either it dosnt work
You cannot use both layout manager
boutton_quitter.place(x=1500, y=100)boutton_quitter.pack(). Use one layout manger to suit your need.When using
fenetre.attributes('-fullscreen', True)Don't set. Layout manager value too high such asplace(). Thepack()is OK to suit your need.I comment out that we doesn't need.
Snippet:
Screenshot: