1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| from tkinter import *
#Fonctions/Commandes :
#Quitter
def Quitter():
fen1.destroy()
#Jouer
def Jouer():
Quitter()
fenetre = Tk()
fenetre.title('SnakeGame by Nicolas and Guillaume')
fenetre['bg']='black'
image=PhotoImage(file='D:/_Bureau/Cours/Terminale/ISN/Projet/background.ppm', master=fenetre)
label2 = Canvas(fenetre, width =1300, height = 1000)
label2.pack()
label2.create_image((500,500),image=image)
fenetre.mainloop()
label2.create_rectangle(100, 150, 800, 800, width=8)
Score = label2.create_text(1050, 125, text="Score", font="!Y2KBUG 70 ", fill="black")
ScoreJoueur = label2.create_text(1050, 275, text="30", font="!Y2KBUG 60", fill="black") #Dans Text il faudra mettre une variable qui sera le score.
command=Quitter
#Menu
fen1 = Tk()
fen1.title('SnakeGame by Nicolas and Guillaume')
fen1['bg']='black'
label1 = Canvas(fen1, width=1300, height=1000, background="black")
label1.pack()
TexteMenu = label1.create_text(650, 100, text="MENU", font="!Y2KBUG 70 underline", fill="white")
bouton1 = Button(label1, anchor='center', text="JOUER", background='black', foreground='white', font="!Y2KBUG 70 ", width='5', command=Jouer)
bouton1.place(x=450 , y=215, width=400, height=250)
bouton2 = Button(label1, anchor='center', text="QUITTER", background='black', foreground='white', font="!Y2KBUG 70 ", width='7', command=Quitter)
bouton2.place(x=450 , y=550, width=400, height=250) |
Partager