Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from threading import Timer,Thread,Event #importation des fonction Timer, Thread et Event de la biblio threadingrom threading import Timer,Thread,Event #importation des fonction Timer, Thread et Event de la biblio threading
- class changiColorTimer():#création de la classe du timer
- def __init__(self,time,fonction):#initialisation des arguments de la fonction
- self.time = time#création des sous variable qui pouron etre utilsé dans les sous fonction(def)
- self.fonction = fonction
- self.thread = Timer(self.time,self.handle_function) #intialisation d'un timer de time seconde et je comprent pas le handle_function
- def handle_function(self):#definition de la fonction handle_function qu je conprend pas
- elf.hFunction()
- self.thread = Timer(self.t,self.handle_function)
- self.thread.start()#demarage du Timer
- def start(self):#définition de la sous fonction start qui demare le timer
- self.thread.start()
- def stop(self):#fonction stopent le timer(avec reste du temps)
- elf.thread.cancel()
- def fonction_a_executer():#fonction étant executer fors de la fint du timer(no redemarent pas le Timer
- print("timer fini")#ecrire juste dans la console que le timer a fait un tour
- t= changiColorTimer(5,fonction_a_executer)#initialisation de je sais pas quoi (t) et on dit que c'est un timer de 5 seconde qui execute a fin du timer la fonction fonction_a_executer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement