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
|
from tkinter import*
from random import randint
fen=Tk()
fen.geometry("800x800")
fen.title("Test de rapidité")
scoretext=Label(fen,text="Score : ",font=("Verdana",20))
scoretext.place(x=620,y=30)
pts=0
def points(pts):
print(pts)
pts=pts+1
scorepts=Label(fen,text=pts,font=("Verdana",20))
scorepts.place(x=730,y=30)
print(pts)
def nvbouton():
bout['text']="Clique ici"
bout.place_forget()
bout.place(x=randint(50,750),y=randint(50,750))
bout=Button(fen,text="Clique ici pour commencer",command=lambda:[nvbouton(),points(pts)])
bout.place(x=330,y=360)
fen.mainloop() |
Partager