from tkinter import * from PIL import ImageTk, Image def tuto(): bouton.destroy() bouton2.destroy() bouton3.destroy() #NOTE : j'ai pas supprimé les labels, et pas besoin de supprimer le bouton4, il suffit juste de poser par dessus. niveau.destroy() #NOTE2 : par contre, il faudra les supprimer à la fin en masse niveau2.destroy() boutoncredits.destroy() etape1 = Label(Menufenetre, text="Etape 1 :") imageniveau = canvas.create_window(250,175, window=etape1) etape2 = Label(Menufenetre, text="Etape 2 :") imageniveau = canvas.create_window(250,375, window=etape2) bouton4 = Button(Menufenetre, text="=>", command=tutosuite) #START boutonfenetre = canvas.create_window(440, 560, window=bouton4) def tutosuite(): global tuto global bouton4 etape3 = Label(Menufenetre, text="Etape 3 :") imageniveau = canvas.create_window(250,175, window=etape3) etape4 = Label(Menufenetre, text="Etape 4 :") imageniveau = canvas.create_window(250,375, window=etape4) bouton5 = Button(Menufenetre, text="<╝", command=retour) #START boutonfenetre = canvas.create_window(440, 560, window=bouton5) #NOTE3 : ICI def retour(): global niveau global bouton global bouton2 global bouton3 global boutoncredits global niveau2 bouton = Button(Menufenetre, text="START", command=jouer, foreground='blue' ) #START boutonfenetre = canvas.create_window(250, 175, window=bouton) niveau = Label(Menufenetre, text='Choix du niveau de difficulté :') #choix imageniveau = canvas.create_window(250, 250, window=niveau) bouton2 = Button(Menufenetre, text=" DEBUTANT ") #DEBUTANT boutonfenetre = canvas.create_window(250, 300, window=bouton2) niveau2 = Label(Menufenetre, text='niveau sélectionné') #choix imageniveau = canvas.create_window(350, 300, window=niveau2) bouton3 = Button(Menufenetre, text=" TUTORIEL ", command=tuto) #TUTORIEL boutonfenetre = canvas.create_window(250, 350, window=bouton3) boutoncredits = Button(Menufenetre, text="Credits", command=credits) #credits boutonfenetre = canvas.create_window(435, 560, window=boutoncredits) def credits(): #affichage des credits global gens1 global gens2 global gens3 global retour2 bouton.destroy() bouton2.destroy() bouton3.destroy() niveau.destroy() niveau2.destroy() boutoncredits.destroy() gens1 = Label(Menufenetre, text='Samuel MABIT') #choix gens1bis = canvas.create_window(250, 220, window=gens1) gens2 = Label(Menufenetre, text='Ange DUVAL') #choix gens2bis = canvas.create_window(250, 260, window=gens2) gens3 = Label(Menufenetre, text='Justin GLEMAREC') #choix gens3bis = canvas.create_window(250, 300, window=gens3) bouton4 = Button(Menufenetre, text="<╝", command=retour2) #START boutonfenetre = canvas.create_window(440, 560, window=bouton4) def retour2(): # flèche retour global niveau global bouton global bouton2 global bouton3 global boutoncredits global niveau2 gens1.destroy() gens2.destroy() gens3.destroy() bouton = Button(Menufenetre, text="START", command=jouer, foreground='blue' ) #START boutonfenetre = canvas.create_window(250, 175, window=bouton) niveau = Label(Menufenetre, text='Choix du niveau de difficulté :') #choix imageniveau = canvas.create_window(250, 250, window=niveau) bouton2 = Button(Menufenetre, text=" DEBUTANT ") #DEBUTANT boutonfenetre = canvas.create_window(250, 300, window=bouton2) niveau2 = Label(Menufenetre, text='niveau sélectionné') #choix imageniveau = canvas.create_window(350, 300, window=niveau2) bouton3 = Button(Menufenetre, text=" TUTORIEL ", command=tuto) #TUTORIEL boutonfenetre = canvas.create_window(250, 350, window=bouton3) boutoncredits = Button(Menufenetre, text="Credits", command=credits) #credits boutonfenetre = canvas.create_window(435, 560, window=boutoncredits) # PROGRAMME DE BASE Menufenetre = Tk() Menufenetre.title('Bataille Navale One Piece') #titre de la fenetre canvas = Canvas(Menufenetre, bg = "blue", height = 600, width =500) #dimensions canvas.pack() canvas.pack(expand = YES, fill = BOTH) #placement du fond de la fenetre img = PhotoImage(file='fond.PNG') canvas.create_image(252,305, image=img) canvas.pack(expand = YES, fill = BOTH) #placement du bateau img2 = PhotoImage(file='sunny.png') canvas.create_image(250,475, image=img2) canvas.pack(expand = YES, fill = BOTH) #placement du ONE PIECE img3 = PhotoImage(file='titre.png') canvas.create_image(250,50, image=img3) Menufenetre.config(cursor='pirate') bouton = Button(Menufenetre, text="START", command=jouer, foreground='blue' ) #START boutonfenetre = canvas.create_window(250, 175, window=bouton) niveau = Label(Menufenetre, text='Choix du niveau de difficulté :') #choix imageniveau = canvas.create_window(250, 250, window=niveau) bouton2 = Button(Menufenetre, text=" DEBUTANT ") #DEBUTANT boutonfenetre = canvas.create_window(250, 300, window=bouton2) niveau2 = Label(Menufenetre, text='niveau sélectionné') #niveau selctionné imageniveau = canvas.create_window(350, 300, window=niveau2) bouton3 = Button(Menufenetre, text=" TUTORIEL ", command=tuto) #TUTORIEL boutonfenetre = canvas.create_window(250, 350, window=bouton3) boutoncredits = Button(Menufenetre, text="Credits", command=credits) #credits boutonfenetre = canvas.create_window(435, 560, window=boutoncredits) canvas.pack() Menufenetre.mainloop() #Menufenetre 1 #canvas 2 #img 3 #img2 4 #img3 5 #bouton1 6 #bouton2 7 #bouton3 8 #bouton4 9 #boutonfenetre 10 #boutoncredits 11 #niveau 12 #niveau2 13 #imageniveau 14 #jouer 15 #tuto 16 #etape1 17 #etape2 18 #tutosuite 19 #etape3 20 #etape4 21 #bouton5 22