Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from random import *
- score_joueur = 0 #Score du joueur ,init a 0
- def start():
- print("start")
- reset()
- nb_couleur = []
- print(nb_couleur)
- tirage(nb_couleur)
- print(nb_couleur)
- def reset():
- print("reset")
- info_score(score_joueur,False)
- actu_texte(tour,1)
- def tirage(nb_couleur):
- print("tirage")
- nb_couleur.append(randint(0,3))
- def info_score(score_joueur,info):
- if info:
- score_joueur = score_joueur + 1
- else:
- score_joueur = 0
- score.configure(text="Votre score: " + str(score_joueur))
- def actu_texte(tour,num):
- tour.configure(text=TOURPOUR[num])
- def flash(nb):
- print("premierrrrrrrrrrrrrrrrrr")
- if nb == 0:
- btn.config(state="active")
- btn.after(100,flash_end(0))
- elif nb == 1:
- btn2.config(state="active")
- btn.after(100,flash_end(1))
- elif nb == 2:
- btn3.config(state="active")
- btn3.after(100,flash_end(2))
- elif nb == 3:
- btn4.config(state="active")
- btn4.after(100,flash_end(3))
- def flash_end(nb):
- print("flashhhhhhhhhhhhhhhh")
- if nb == 0:
- btn.config(state="normal")
- elif nb == 1:
- btn2.config(state="normal")
- elif nb == 2:
- btn3.config(state="normal")
- elif nb == 3:
- btn4.config(state="normal")
- nb_couleur = []
- COULEUR = ["rouge","bleu","jaune","vert"]
- TOURPOUR = ["Clique sur commencer pour jouer","C'est a votre tour de jouer","Patience"]
- root=Tk()
- root.title("Jeu de Simon")
- root.resizable(False, False)
- tour = Label(text=str(TOURPOUR[0]),font=10)
- tour.grid(row=0,column=0,columnspan=2,sticky="")
- btn=Button(root,width=20,height=14,bg="#EE575B",activebackground="red")
- btn.grid(row = 1,sticky="e")
- btn2=Button(root,width=20,height=14,bg="#61A1CA",activebackground="blue")
- btn2.grid(row=1,column=1,sticky="w")
- btn3=Button(root,width=20,height=14 ,bg="#65E265",activebackground="green")
- btn3.grid(row=2,column=0,sticky="e")
- btn4=Button(root,width=20,height=14,bg="#FFE772",activebackground="yellow")
- btn4.grid(row=2,column=1,sticky="e")
- score = Label(text="Votre score: " + str(score_joueur),font=10)
- score.grid(row=3,column=0,sticky="w")
- btn_start = Button(root,text="COMMENCER",width=16,height=1,bg="white",font="Helvetica",fg="#7A4A4B",command=start)
- btn_start.grid(row=3,column=1)
- btn4.after(1000,flash(2))
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement