Created
November 13, 2015 21:39
-
-
Save HuproZ/86b6a698e0bd6d59512d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: cp1252 -*- | |
import time, os | |
from Tkinter import * | |
from math import * | |
import random | |
from tkMessageBox import * | |
##################################################### | |
countdown=True | |
c2=True | |
c3=True | |
def new(): | |
def decompte(lab, count=10): | |
lab.config(text="{:.2f}".format(count)) | |
if count > 0 and countdown: | |
fen1.after(10,decompte, *(lab, count-0.01)) | |
if count<0.2: | |
lab4.configure(text="BIEN !", bg="green") | |
if 0.2<count<0.4: | |
lab4.configure(text="Pas mal !", bg="orange") | |
if count>0.4: | |
lab4.configure(text="A chier !", bg="red") | |
def decompte2(lab1, count=10): | |
lab1.config(text="{:.2f}".format(count)) | |
if count > 0 and c2: | |
fen1.after(10,decompte2, *(lab1, count-0.01)) | |
def decompte3(lab2, count=10): | |
lab2.config(text="{:.2f}".format(count)) | |
if count > 0 and c3: | |
fen1.after(10,decompte3, *(lab2, count-0.01)) | |
def stop(): | |
global countdown | |
countdown = False | |
def stop2(): | |
global c2 | |
c2 = False | |
def stop3(): | |
global c3 | |
c3 = False | |
fen1=Tk() | |
fen1.geometry("500x500") | |
lab=Label(fen1, text="") | |
lab.pack() | |
lab1=Label(fen1, text="") | |
lab1.pack() | |
lab2=Label(fen1, text="") | |
lab2.pack() | |
lab3=Label(fen1,text="") | |
lab3.place(x=300,y=200) | |
lab4=Label(fen1,text="") | |
lab4.place(x=100,y=250) | |
x=(random.uniform(1.5,2)) | |
y=(random.uniform(3,3.5)) | |
z=(random.uniform(4.5,5)) | |
decompte(lab, x) | |
decompte2(lab2, y) | |
decompte3(lab3,z) | |
btn1=Button(fen1, text="stop", command=stop) | |
btn1.pack() | |
btn5=Button(fen1, text="Stop2", command=stop2) | |
btn5.pack() | |
btn6=Button(fen1, text="Stop3", command=stop3) | |
btn6.pack() | |
btn3=Button(fen1, text="quit",command=fen1.destroy) | |
btn3.pack() | |
lab.place(x=100,y=200) | |
lab1.place(x=150,y=200) | |
lab2.place(x=200,y=200) | |
def recommencer(): | |
global countdown | |
global c2 | |
global c3 | |
countdown= True | |
c2=True | |
c3=True | |
fen1.destroy() | |
new() | |
btn4=Button(fen1, text="rejouer", command=recommencer) | |
btn4.pack() | |
###################################################### | |
fenetre= Tk() | |
fenetre.configure(bg="black") | |
fenetre.geometry("1024x620") | |
canvas= Canvas(fenetre, width=1024, height=620,bg="black") | |
canvas.grid(row=0, column=0) | |
photo = PhotoImage(file="demineur.gif") | |
canvas.create_image(512,310, image=photo) | |
def demande(): | |
askyesno("Prêt(e)?","Êtes-vous prêt(e) ?",parent=fenetre,type='ok') | |
new() | |
btn= Button(fenetre, text="JOUER",bg="yellow",command=demande) | |
btn.place(x=240,y=500) | |
fenetre.mainloop() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment