from tkinter import * from time import * font1 = '-size 40' #Création et paramétage de la fenêtre fen = Tk() fen.title=('Timer') fen.geometry('260x170') Tps_total = 0 Début = 0 tps = 0 ité = 1 chrono = '00:00:00' Aff = Label(fen,text=chrono) Aff.place(y=10,x=25) Aff.configure(font=font1) def timer(): global tps,ité,font1,Aff while ité != 0: Aff.destroy() test = int(time()) sleep(0.1) test1 = int(time()) if test != test1: tps = int(tps) + 1 chrono = strftime('%H:%M:%S', gmtime(tps)) Aff = Label(fen,text=chrono) Aff.place(y=10,x=25) Aff.configure(font=font1) def debut_du_chrono(): timer () def fin_du_chrono(): global ité ité = 0 print('good') pause = PhotoImage(file="pause.gif") Arrêter = Button(fen,image=(pause),command=fin_du_chrono) Arrêter.place(x=147,y=90) play = PhotoImage(file="play.gif") commencer = Button(fen,command=debut_du_chrono,image=(play)) commencer.place(x=5,y=90)